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.

HTTPGet


Spol Feb 13, 2020 03:20 PM

Hi,

since a week ago my CR1000 was able to send an HTTP request to Telegram Api to send a message. Saddenly the response turn into "Http comms error" and no message was sent any more.

Following the essential code:

Public HTTP_Success As String * 512
Public HTTP_Response As String * 1024
Public HTTP_Header As String * 512

HTTP_Header = ""
HTTP_Success = HTTPGet("https://api.telegram.org/botXXXXXXXXXXXX/sendMessage?chat_id=XXXX&text=Hello", HTTP_Response, HTTP_Header)

I tried sending a call to "http://api.ipify.org" and all went ok with the ip in the Response.

If I change from HTTPS to HTTP I receive the following answer, without any error


' HTTP/1.1 301 Moved Permanently
' Server: nginx/1.16.1
' Date: Thu, 13 Feb 2020 13:53:12 GMT
' Content-Type: text/html
' Content-Length: 169
' Connection: keep-alive
' Location: https://api.telegram.org/xxxxxx/sendMessage?chat_id=xxxxxx&text=Hello

Is there anything I can try?

Thank you,

Paolo


jtrauntvein Feb 14, 2020 11:11 PM

The HTTP response code that you are getting is called a redirect and is telling you that the URL that the service you are attempting to access is now at a different location.  You will need to update the URL parameter to match the value sent in the "Location:" field in the response header.


Spol Feb 15, 2020 09:23 AM

Thank you,

I tried with the URL as suggested in the Location: https://api.telegram.org/...."  but then I get "Http comms error" and nothing else... May be I need to set some Headers?

Paolo


Dulthichuraw1981 Sep 29, 2021 03:54 AM

This post is under review.

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