I have written an app that reads xml data using HTTPSocket.get(URL,30).
I now have started to receive Http 302 Found message, however the new URL redirection address is exactly the same as the one in my HTTPSocket.get.
I would be grateful for any help as to why this is happening or how to get around it. Iam using real studio 2012 r2.
Some ideas for you to chew on: https://webmasters.stackexchange.com/questions/74507/what-s-up-with-this-302-redirect-to-the-same-url
Without knowing the actual request youre trying to make, itll be hard to determine anything specific.
I should of said that I retry the request 10 times and still get a 302 each time.
Thanks I did have a look at the above stackexchange question but that is slighty different to mine in that they seem to get through ok on the 3rd retry and they are using php curl.
The actual request that I am making is
Dim http As HTTPSocket
Data = http.Get (“https://bb.ringingworld.co.uk/export.php?id=1218138&fmt=xml”,30)
I then retry 10 times before giving up.
Speaking out of ignorance - anything to do with cookies?
It could be but if it is, it is from the server side. Their api does not mention anything about cookies.
I get the same results using the http example out of the sample project file
I can’t reproduce what you’re seeing, that url always returns 200 for me, even if I force an HTTP 1.0 connection. If I had to guess, it’s related to ssl. But even if I use HTTP instead of HTTPS, I still get a 200 reply.
What software and level did you use? I also got the same failure using the http example out of the sample project file that came with real studio 2012 r2.
I’m using cURL requests. I need to be able to see what the server is doing to offer any advice, which I can’t really see using the HTTPSocket.
I this something that I could use in my RB app instead of HTTPSocket? I know that several php scripts that access the URL without any problems.
MBS plugins have cURL features. Or if you upgrade to a newer version of Xojo you can use the Xojo.Net.HTTPSocket which uses the system libraries.
If you are on macOS you can just shell out to curl:
dim sh as new Shell
sh.Execute("curl -L ""https://bb.ringingworld.co.uk/export.php?id=1218138&fmt=xml""")
dim result as string = sh.Result
[quote=375487:@Jared Feder]If you are on macOS you can just shell out to curl:
dim sh as new Shell
sh.Execute("curl -L ""https://bb.ringingworld.co.uk/export.php?id=1218138&fmt=xml""")
dim result as string = sh.Result
[/quote]
While true, I believe this will be more work than its worth. With this url, the process appears to daemonize for a moment, which I certainly didn’t expect, and also doesn’t finish. The server is definitely doing something unexpected, it might be a caching system of some sort. I think David would end up spending too much time fixing edge cases.
I just get 200s - interacting with a plain TCP socket under RS 2011r2. An interaction ( works the same if HTTP/1.0):
URL: https://bb.ringingworld.co.uk/export.php?id=1218138&fmt=xml
[code]
GET /export.php?id=1218138&fmt=xml HTTP/1.1
Host: bb.ringingworld.co.uk
Accept: /
Connection: close
User-Agent: DownLoder/4.0
Referer: http://bb.ringingworld.co.uk/
< HTTP/1.1 200 OK
< Date: Wed, 28 Feb 2018 14:59:48 GMT
< Server: Apache/2.4
< Content-Disposition: inline; filename=“export.xml”
< Connection: close
< Transfer-Encoding: chunked
< Content-Type: application/xml
< [/code]
Thanks to everyone for their input.
I will not have internet access until next week when virgin get round to replacing my broken hub
I have sorted out my problem by using an HTTPSecureSocket with a connection type of SSLSocket.TLSv1.
My thanks for all the help and advice that I received