OK, works.


The response is ">". Works fine, but

GET /androidserver.aspx?param=esp8266 Http/1.1\r\nHost: zgrdataserver.com.azhar.arvixe.com\r\n\r\n

This code, no matter what, always returns either HTTP 400 bad request error or Wrong syntax error. Ironically, all the examples on the internet that I found use thingspeak.com API example. However I want to use my own server to log data. Thank you for any efford, in advance.

For those who wonder http://zgrdataserver.com.azhar.arvixe.com/androidserver.aspx?param=asdf request works perfectly fine.

  • 5
    \$\begingroup\$ I'm voting to close this question as off-topic because StackExchange rather than electronics \$\endgroup\$
    – user16222
    Commented May 10, 2015 at 18:14
  • \$\begingroup\$ @JonRB Electronics is more of about embedded systems rather than "electrical", but I respect what you think. \$\endgroup\$
    – Zgrkpnr
    Commented May 10, 2015 at 18:20
  • 2
    \$\begingroup\$ where is the electronics? nothing in what is listed is electronics? The issues you have listed are more http issues. Just stating an electronics card doesn't make it an electronics issue unless it is shown to be associated wit that module as oppose to std ASP coding and https GET sequencing. If a tcp connection is established then the hardware/electronics should be fine \$\endgroup\$
    – user16222
    Commented May 10, 2015 at 18:30
  • 1
    \$\begingroup\$ @JonRB For your question "everywhere". You know anything about Data Networks? Network Engineering? That's a branch of Electronics Engineering. And this question is very crucial for my datalogger device to be cheaper than it uses a common local server first. If you want to be an Electronics Engineer, from now on, network is everywhere and you should search for low cost solutions. This question about the module is my efford to do so. \$\endgroup\$
    – Zgrkpnr
    Commented May 10, 2015 at 18:38
  • \$\begingroup\$ @JonRB This is a perfectly valid question here. The ESP8266 is a small ARM based embedded WiFi module and the use and programming of it is as valid as the use and programming of a PIC, AVR or other embedded system. \$\endgroup\$
    – Majenko
    Commented May 10, 2015 at 18:43

2 Answers 2


You have an error in your HTTP request, the HTTP version should be uppercase (i.e. HTTP/1.1). Try your requests on a computer with telnet first. I get the following output:

$ telnet zgrdataserver.com.azhar.arvixe.com 80
Connected to zgrdataserver.com.azhar.arvixe.com.
Escape character is '^]'.
GET /androidserver.aspx?param=esp8266 Http/1.1
HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=us-ascii
Server: Microsoft-HTTPAPI/2.0
Date: Sun, 10 May 2015 18:54:39 GMT
Connection: close
Content-Length: 311

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request</h2>
<hr><p>HTTP Error 400. The request is badly formed.</p>
Connection closed by foreign host.

Notice that the server responds immediately after sending the first line. With a correct request I get:

$ telnet zgrdataserver.com.azhar.arvixe.com 80
Connected to zgrdataserver.com.azhar.arvixe.com.
Escape character is '^]'.
GET /androidserver.aspx?param=esp8266 HTTP/1.1
Host: zgrdataserver.com.azhar.arvixe.com

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/8.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Sun, 10 May 2015 18:55:53 GMT
Content-Length: 846


This is at least part of your problem.

As a suggestion, use HTTP/1.0 instead of HTTP/1.1. This prevents the server from sending chunked data and it will also automatically close the connection (without a Connection header in the request).

  • \$\begingroup\$ Although it worked in telnet, I still need to send it from microcontroller like "GET /androidserver.aspx?param=esp82662 HTTP/1.1\r\nHost: zgrdataserver.com.azhar.arvixe.com\r\n\r\n" this. Get command and Host should be sent at the same time. For escape sequences I am not sure how to send \$\endgroup\$
    – Zgrkpnr
    Commented May 10, 2015 at 19:24

The problem here is to do with your line endings, and how you are sending them.

The ESP8266 is very fussy about how you send the data, and just sending a string including things like \r won't work.

I managed to get it to work by using a Linux system and first manually (using minicom) sending the commands to open the port and send the data. Then I piped a file containing the request with the properly formatted line ending characters in it to the serial device (sending an ASCII file would probably have worked too).

Sending the data is really supposed to be done fully programatically using an "expect - send" schema (you expect something, then you send a response to it).

So sending would be a case of:

Expect           Send
======           ====
<nothing>        AT+CIPSTART="TCP","zgrdataserver.com.azhar.arvixe.com",80
OK               AT+CIPSEND=92
>                <your data, including the actual characters 13 and 10>
SEND OK          <nothing>

You may think it a little odd doing it that way around - better you'd think to do "send - expect" instead of "expect - send". You may well be right, but that is the traditional way around that modem control systems have used right since the days of UUCP.

  • \$\begingroup\$ I guess I got the point.I'll give it a try and let you know immediately. \$\endgroup\$
    – Zgrkpnr
    Commented May 10, 2015 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.