Using simple HTTPSocket

I am trying to get a text file from a website and parse it.

I thought this worked in the past, but now it doesn’t seem to get me any text:

[code] dim h as new HTTPSocket
dim z as string
call h.get (“http://www.ursasoftware.com/allok.htm” ,6)
z = h.Read (3000,nil)
if h.HTTPStatusCode = 200 and z > “” then
msgbox z

  end if[/code]

I know the file exists (although its currently unused by the actual site)

This should get the text synchronously, waiting up to 6 seconds.
The status code should be 200 if the data is received: it is, but the READ call gets no bytes,
and the CONTENTS of the httpsocket in the debugger is empty.

you can’t use the async version like this. Instead of using Call, just use:

s = h.get…

Worryingly, I have been using the other version for a year or two now, and I am sure it was working at one point.

Im sure you are mistaken. Or extremely lucky. That syntax should never work.

I know this is an old thread… but HELP?!

  Dim s As String
  Dim download_site As String
  download_site=Lowercase("http://<address>))
  http.Yield=True
  s=http.Get(download_site)

last line

And the current docs on HTTPSocket don’t even MENTION GET anymore

All I need to to is call the URL … which will return a string

FYI… same result with

s=http.SendRequest(“GET”,download_site)

You forgot the timeout. Without timeout it is on asychronous mode, so Get doesn’t return anything.

Just replace that last line with:

s=http.Get(download_site,15) // 15 seconds timeout

[quote=276241:@Ashot Khachatryan]You forgot the timeout. Without timeout it is on asychronous mode, so Get doesn’t return anything.

Just replace that last line with:

s=http.Get(download_site,15) // 15 seconds timeout

Thanks… interesting thing is the code (older project) that I copied it from did not have a timeout on it and it had worked