dim creditamount as string
Dim credits As New HTTPSocket
creditamount = credits.Get("http://api.website.com/http/getbalance?api_id=xxx&user=xxx&password=xxx",5)
The above code used to work in earlier versions of Xojo, it no longer seems to work in Version 2015r3,1. Has anything changed or does my code need tweaking?
If I type the ‘get line’ line into a web browser I get the correct answer which is a simple line of text;
This is the value that would previously have been placed in creditamount.
I am in fact receiving nothing at all back from the website.
Try it with the HTTPSocket from the new framework: xojo.Net…
I see two possible issues That would certainly cause an empty response.
- 5 seconds may not be long enough.
- I would expect you to need to use https to an app that asks for a username/password.
You can probably tell though… What’s the value of HttpStatus? A value of zero will mean that the timeout was reached.
Its definitely HTTP, despite it asking for a password and username, the response directly typing into a web browser is instant, and even changing to 10 seconds makes no difference.
Not sure if that helps in any way.
What happens if you change it to an async request?
Does it work if you go back to an older IDE?
If not, have you tried Xojo.Net.HTTPSocket as recommended above? The server may be expecting HTTP1.1 from a recent change.
There’s many things to try. If you need personal support, I’ve recently found myself with a lot of extra time I’d be willing to sell
[quote=236906:@Paul Budd]Its definitely HTTP, despite it asking for a password and username, the response directly typing into a web browser is instant, and even changing to 10 seconds makes no difference.
Not sure if that helps in any way.[/quote]
If a browser works fine, I suggest that you set the useragent property. It may be that the API expects requests to come from a browser.
I originally wrote the application in Realbasic, and that version is working. I don’t have an RB IDE installed so will look at the Xojo.Net.HTTPSocket. When I initially tried this I got 'There is more than one item with this name and its not clear to which this refers?
Not really used the new frameworks as yet so a little learning to do. Just tried the below two lines and get the error described. I assume I have to put a ‘Using …’ somewhere?
Dim outputFile As Xojo.IO.FolderItem = Xojo.IO.SpecialFolder.Documents.Child("data.json")
credits.Send("GET", "http://api.website.com/http/getbalance?api_id="+httpid+"&user="+user+"&password="+pass, outputFile)
I’ll have a look at the shipped examples to see where I am going wrong in the meantime.
Thanks all, the next framework socket did the trick.