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
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.
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
This post is under review.