Telegram Bot
Posted: Thu Aug 06, 2015 9:04 am
Hello,
I am trying to build a Telegram Bot with the new API, but i have a problem with send the request.
When i try to send a request comment with the NodeMCU i don't get nothing
My Code is:
After it run i Get:
Hope that you can tell me what i am doing wrong
I am trying to build a Telegram Bot with the new API, but i have a problem with send the request.
When i try to send a request comment with the NodeMCU i don't get nothing
My Code is:
Code: Select all
HOST = 'api.telegram.org'
conn=net.createConnection(net.TCP, 0)
conn:on("receive", function(conn, payload) print(payload) end )
conn:connect("443",HOST)
conn:send("GET / HTTP/1.1\r\nHost: https://api.telegram.org/bot<My_Token_Code>/getUpdates \r\n"
.."Connection: keep-alive\r\nAccept: */*\r\n\r\n")
After it run i Get:
Code: Select all
HTTP/1.1 400 Bad Request
Server: nginx/1.6.2
Date: Thu, 06 Aug 2015 14:00:05 GMT
Content-Type: text/html
Content-Length: 172
Connection: close
<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.6.2</center>
</body>
</html>
Hope that you can tell me what i am doing wrong