HTTP example

I have an app built in C# .Net that I want to try and port to the RPI. I am not having much luck getting my code to run (using MONO, EXAGEAR, etc) so I thought I’d try to rebuild it in XOJO.
I am testing a simple HTTPS request that runs fine in my browser but returns nothing when I run it in XOJO. I can’t find my error and would appreciate any insight. Here is the code:

Dim secureSite As New HTTPSecureSocket
secureSite.Secure = True
Dim data As String
Dim sQuery as String
data = secureSite.Get (sQuery, 5)

I don’t see any errors and “data” is empty when the function returns. Again, if I put “sQuery” into my browser I get the expected results.


In your posted code, sQuery is the empty string. Assuming this is because you can’t share the actual URL, the next most likely suspect is that the server wants a newer version of SSL/TLS than what you’re using (defaults to TLSv1.) Try adding this to tell the socket to use the latest version (TLSv1.2):

secureSite.ConnectionType = secureSite.TLSv12

I tried assigning TLSv12 but get the same empty string returned. Do I need to setup a port?

Are you getting a redirect? Try running the Get async and check the events that fire.

You don’t have to do that. Just check secureSite.HTTPStatusCode. If it’s 301 or 302, look at the returned headers for one named Location to tell you where to send your query.