I am working on an application used by Amateur (Ham) Radio Operators. The program will access a web site (QRZ.com) to first login the user and later retrieve information about other radio operators. The website offers an XML account service that I am trying to access via an HTTPSocket.
I have been unable to get a response using the HTTPSocket, but an HTMLViewer displays the XML response without a problem.
I have a Main Window with a push button and an HTMLViewer. The following code is contained in the Push Button Action event handler.
Dim qrz_socket As New HTTPSocket
Dim qrz_response As String
Dim qrz_query As String
I ran into your post after having similar problems. I tried your code and it does the same for me as you. AVG doesn’t seam to be the cause, nor does windows firewall.
I’ve been running some tests back and forth with my server changing headers using php and found something interesting:
If i send headers similar to this:
Content-Length: 475
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
It does not work, and I see no content length in the html source viewer (i’m using an old OstroSoft Internet Tools app to look at it)
I can’t even get www.google.com, they send no content-length either. However, they do on 404 pages so I tried www.google.com/k and it worked.
Is this a bug in HTTPSocket? or am I missing a setting for it?
Sorry I don’t have any answer for you, but I did get closer to the cause. Hopefully this will spark an idea from another member, as I’m also hoping for a solution.
HTTPSocket is rather Raw. It just asks the server for the data at the URL you provide. HTMLViewer has webkit behind it, so it’ll run any javascript and interpret any headers that are delivered (including redirects).
Looking at your examples, it appears that the main issue is that HTTPSocket is using the 1.0 protocol and the server you are connecting to is expecting and responding in HTTP/1.1. (Connection: Keep-Alive and Connection: Close are both part of the 1.1 protocol)
Before you do that, try setting the user-agent header for the httpsocket. It could be that they only return content for something that says it is a browser. You should be able to get a valid user agent string by doing a google search.