# HTTPS GET fails in socket, works in Safari :-!

**URL:** <https://forum.xojo.com/t/https-get-fails-in-socket-works-in-safari/30362>\
**Category:** macOS\
**Created:** [March 17, 2016, 4:24am UTC](https://forum.xojo.com/t/https-get-fails-in-socket-works-in-safari/30362 "2016-03-17T04:24:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony\_Barry](https://forum.xojo.com/user_avatar/forum.xojo.com/tony_barry/32/2887_2.png) [@Tony\_Barry](https://forum.xojo.com/u/Tony_Barry)\
**Post date:** [March 17, 2016, 4:24am UTC](https://forum.xojo.com/t/https-get-fails-in-socket-works-in-safari/30362/1 "2016-03-17T04:24:17Z")

</div>

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](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

1. Safari correctly deals with the GET , and sets up the socket to work properly.
2. My code doesn’t.

Any thoughts on what is going wrong ?

Regards,  
Tony Barry

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [March 17, 2016, 4:41am UTC](https://forum.xojo.com/t/https-get-fails-in-socket-works-in-safari/30362/2 "2016-03-17T04:41:36Z")

</div>

Couple of things:

- SSLSocket.SSLv23 is probably too old. Try one of the TLS versions.
- They may require a user agent.
- They may require the use of cookies.
- Try using the new sockets, they may require HTTP/1.1

---

<div class="post-metadata">

**Author:** ![Tony\_Barry](https://forum.xojo.com/user_avatar/forum.xojo.com/tony_barry/32/2887_2.png) [@Tony\_Barry](https://forum.xojo.com/u/Tony_Barry)\
**Post date:** [March 17, 2016, 6:44am UTC](https://forum.xojo.com/t/https-get-fails-in-socket-works-in-safari/30362/3 "2016-03-17T06:44:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Tony\_Barry](https://forum.xojo.com/user_avatar/forum.xojo.com/tony_barry/32/2887_2.png) [@Tony\_Barry](https://forum.xojo.com/u/Tony_Barry)\
**Post date:** [March 18, 2016, 3:08am UTC](https://forum.xojo.com/t/https-get-fails-in-socket-works-in-safari/30362/4 "2016-03-18T03:08:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Phillip\_Zedalis](https://forum.xojo.com/user_avatar/forum.xojo.com/phillip_zedalis/32/1151_2.png) [@Phillip\_Zedalis](https://forum.xojo.com/u/Phillip_Zedalis)\
**Post date:** [March 18, 2016, 3:27am UTC](https://forum.xojo.com/t/https-get-fails-in-socket-works-in-safari/30362/5 "2016-03-18T03:27:54Z")

</div>

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://”

---

<div class="post-metadata">

**Author:** ![Tony\_Barry](https://forum.xojo.com/user_avatar/forum.xojo.com/tony_barry/32/2887_2.png) [@Tony\_Barry](https://forum.xojo.com/u/Tony_Barry)\
**Post date:** [March 18, 2016, 3:35am UTC](https://forum.xojo.com/t/https-get-fails-in-socket-works-in-safari/30362/6 "2016-03-18T03:35:01Z")

</div>

Thank you Phillip. Now I must think on this. And that … will hurt.

Regards,  
Tony Barry

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 6:13pm UTC](https://forum.xojo.com/t/https-get-fails-in-socket-works-in-safari/30362/7 "2020-10-29T18:13:57Z")

</div>


