dim creditamount as string
Dim credits As New HTTPSocket
creditamount=""
creditamount = credits.Get("http://api.website.com/http/getbalance?api_id=xxx&user=xxx&password=xxx",5)
credits.Disconnect
credits.close
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;
Credits: 5000
This is the value that would previously have been placed in creditamount.
I am in fact receiving nothing at all back from the website.
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.
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.
_httpStatusCode=200
_PageComplete=false ?
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.