I have an app which uses SSL sockets and HTTPS GET to query a web API and send SMS.
The GET statement is as follows:-
https://www.traitel.com.au/smsgateway.pl?user=ABCDE&pass=XYZ123&to=61439421189&message=Hi%20Tony%20keep%20safe%20!&concatenate=true&output=verbose
(user and password have been obfuscated).
When I paste this into my Safari web browser address bar, it works.
When I do a HTTPS GET it fails.
My code is
(traitel is a HTTP Secure Socket on the page as a property.)
(urlString is the GET statement pasted above.)
(returnedData is a string property of the page.)
traitel.Yield = false //does not let other things happen
traitel.Secure = true
traitel.ConnectionType = SSLSocket.SSLv23
returnedData = traitel.Get(urlString, socketTimeOut)
I get back the following error:-
??403 Forbidden??
Forbidden
?
You don't have permission to access /smsgateway.pl?on this server.
??
From this I gather that
- Safari correctly deals with the GET , and sets up the socket to work properly.
- My code doesn’t.
Any thoughts on what is going wrong ?
Regards,
Tony Barry
Thank you Greg.
Much appreciated.
This I presume is Xojo.Net.HTTPsocket.
The examples are few and far between. Are iOS sockets used in the same manner as regular sockets ?
Regards,
Tony Barry
Hi Greg and friends,
I am having a bit of trouble with the HTTP1.1 sockets.
Where is the timeout value ? I see that a timeout event fires in the NetException event (constant = 9) … but how is this timeout set ?
How does one make the socket not yield ? I do need to set the timeout (see above) but I am happy for the app to “go away” for ten seconds to get data.
How does one set the socket to Secure ? Or is this magically set by using a “https://” URL ?
How does one get the results of a GET back in memory ? The examples show a “saveFileToDisk” option, but not an in-memory option.
The example I am working from is from the downloaded examples as part of the Xojo folder, in the path
/Example Projects/Xojo Framework/HTTPSocketGetExample.xojo.binary.project
Regards
Tony Barry
New socket is asynchronous. You cannot set a timeout any longer but must handle its events. To get the content returned use the PageReceived event.
SSL support is “magical” as you call it by using a “https://” in the URL as opposed to a “http://”
Thank you Phillip. Now I must think on this. And that … will hurt.
Regards,
Tony Barry