Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

CR1000- HTTPGET - HTTP and HTTPS


Angelo_ingv_ct Nov 7, 2016 09:42 AM

Hello, 

I'm working with CR1000 OS30 and loggernet 4.3 (build 4.3.0.2), with NL115 interface, and auto IP adrressing DHCP. 

I need to use the HTTPget command calling a HTTPS server but I haven't any feedback from it.

To investigate this problem I'm using the http://api.ipify.org service that feedbacks the external IP adress (that it works using also https://api.ipify.org)

Trying the command CODE 1 or CODE 2, I always have the feedback from code 1, but never from CODE 2.

From user manual you wrote that I can use the HTTPget calling a HTTPs server.

How I solve this issue ?

thanks.

Angelo Ferro.

'------------CODE 1 -HTTP REQUEST------------

'-------------working routine -  feedback the external IP adress----


Public get_success
Public HTTPResponse As String *100
Public Flag As Boolean

BeginProg

Scan (20,Sec,3,0)

If Flag
get_success =HTTPGet ("http://api.ipify.org",HTTPResponse,"")
Flag= false
EndIf
NextScan

EndProg

'---------------------------------------------------

'------------CODE 2 HTTPS REQUEST------------

'-------------not working  routine - feedback any IP adress----

Public get_success
Public HTTPResponse As String *100
Public Flag As Boolean

BeginProg

Scan (20,Sec,3,0)

If Flag
get_success =HTTPGet ("https://api.ipify.org",HTTPResponse,"")
Flag= false
EndIf
NextScan

EndProg

'---------------------------------------------------


GaryTRoberts Nov 22, 2016 04:49 AM

Instead of having a empty string for http_header in HTTPGet, use a variable.

ie http_header As String * 250

http_header = ""  'empty this out every scan so we don't sent header information in our HTTPGet request.

get_success = HTTPGet("https://api.ipify.org", HTTPResponse, http_header).

http_header should have some information in it that will help you to troubleshoot what is going on.


Angelo_ingv_ct Nov 22, 2016 07:01 AM

Hello Gary, 

added your instructions but still not working using the https request.

when I call the instrution (flag=true) , after some seconds i have :

HTTPResponse="Http comms Error"

get_success=0

instead from http request from HTTPResponse I obtain my external ip address.


Public get_success
Public HTTPResponse As String *100
Public Flag As Boolean
Public http_header As String * 250
BeginProg

Scan (20,Sec,3,0)

http_header = ""

If Flag
     http_header = ""
     get_success = HTTPGet("https://api.ipify.org", HTTPResponse, http_header)
     Flag= false
EndIf


NextScan

EndProg

Log in or register to post/reply in the forum.