user50185: I am trying to upload information to my appspot created with Google App Engine. I am able to do it when I in my browser type:
http://myname.appspot.com/query?city=Copenhagen&temp=20&id=website
But I cannot get it to work on the ESP8266. Here is my code:
const char* MY_URL = "http://myname.appspot.com";

void uploadHTTP() {
    // Define the WiFi Client
    WiFiClient client;
    // Set the http Port
    const int httpPort = 80;

    // Make sure we can connect
    if (!client.connect(MY_URL, httpPort)) {
        return;
    }
    else {
        Serial.println("Connected to MY_URL");
    }

    String url = "/query?city=Copenhagen&temp=20&id=ESP8266";

    // Post to appspot
    if (client.connect(MY_URL, httpPort)) {

        // Sent HTTP POST Request
        client.println("POST " + url + " HTTP/1.1");
        Serial.println("POST " + url + " HTTP/1.1");
        client.println("Host: " + String(MY_URL));
        Serial.println("Host: " + String(MY_URL));
        client.println("User-Agent: Arduino/1.0");
        Serial.println("User-Agent: Arduino/1.0");
        client.print("Content-Length: ");
        Serial.print("Content-Length: ");
        client.println(0);
        Serial.println(0);
        client.println("Content-Type: application/x-www-form-urlencoded");
        Serial.println("Content-Type: application/x-www-form-urlencoded");
        client.println("Connection: close");
        Serial.println("Connection: close");
        }
    //Done
    Serial.println("");
    Serial.println("my HTTP done");
    Serial.println("");
}


user4143: Your biggest problem is that you are trying to use a website URL as a FQDN. That's not going to work.
When you connect to a remote machine you connect to the name (myname.appspot.com) which gets translated into an IP address for you to open a connection to.  
When you use a web browser it parses the URL to extract the protocol (http) and the FQDN (myname.appspot.com) and uses the protocol to determine the port (and what language to speak) to connect to, then look up the IP address from the FQDN.
You need to drop the http:// from your FQDN which is causing it to break (there is no host called http://myname.appspot.com).  The fact that you are connecting to port 80 and speaking the HTTP language implies that you are using HTTP.
To put it into more layman's terms: if you "need to call Fred to talk about going to the pub" you first look up fred's number in the phone book then call that number. Then only once he has answered do you talk about going to the pub. What you don't do is try and find the number to call by looking in the phone book under "talk about going to the pub with Fred". It won't be there. 
If you are programming your ESP8266 directly you should consider using the much simpler bundled ESP8266HTTPClient.h library.

50185: <p>I am trying to upload information to my appspot created with Google App Engine. I am able to do it when I in my browser type:<br>
<a href="http://myname.appspot.com/query?city=Copenhagen&amp;temp=20&amp;id=website" rel="nofollow noreferrer">http://myname.appspot.com/query?city=Copenhagen&amp;temp=20&amp;id=website</a><br>
But I cannot get it to work on the ESP8266. Here is my code:</p>

<pre><code>const char* MY_URL = "http://myname.appspot.com";

void uploadHTTP() {
    // Define the WiFi Client
    WiFiClient client;
    // Set the http Port
    const int httpPort = 80;

    // Make sure we can connect
    if (!client.connect(MY_URL, httpPort)) {
        return;
    }
    else {
        Serial.println("Connected to MY_URL");
    }

    String url = "/query?city=Copenhagen&amp;temp=20&amp;id=ESP8266";

    // Post to appspot
    if (client.connect(MY_URL, httpPort)) {

        // Sent HTTP POST Request
        client.println("POST " + url + " HTTP/1.1");
        Serial.println("POST " + url + " HTTP/1.1");
        client.println("Host: " + String(MY_URL));
        Serial.println("Host: " + String(MY_URL));
        client.println("User-Agent: Arduino/1.0");
        Serial.println("User-Agent: Arduino/1.0");
        client.print("Content-Length: ");
        Serial.print("Content-Length: ");
        client.println(0);
        Serial.println(0);
        client.println("Content-Type: application/x-www-form-urlencoded");
        Serial.println("Content-Type: application/x-www-form-urlencoded");
        client.println("Connection: close");
        Serial.println("Connection: close");
        }
    //Done
    Serial.println("");
    Serial.println("my HTTP done");
    Serial.println("");
}
</code></pre>
 4143: <p>Your biggest problem is that you are trying to use a website URL as a FQDN. That's not going to work.</p>

<p>When you connect to a remote machine you connect to the name (<code>myname.appspot.com</code>) which gets translated into an IP address for you to open a connection to.  </p>

<p>When you use a web browser it parses the URL to extract the protocol (<code>http</code>) and the FQDN (<code>myname.appspot.com</code>) and uses the protocol to determine the port (and what language to speak) to connect to, then look up the IP address from the FQDN.</p>

<p>You need to drop the <code>http://</code> from your FQDN which is causing it to break (there is no host called <code>http://myname.appspot.com</code>).  The fact that you are connecting to port 80 and speaking the HTTP language implies that you are using HTTP.</p>

<p>To put it into more layman's terms: if you "need to call Fred to talk about going to the pub" you first look up fred's number in the phone book then call that number. Then only once he has answered do you talk about going to the pub. What you <em>don't</em> do is try and find the number to call by looking in the phone book under "talk about going to the pub with Fred". It won't be there. </p>

<p>If you are programming your ESP8266 directly you should consider using the much simpler bundled <code>ESP8266HTTPClient.h</code> library.</p>
