From afc9ad2663e5f504d96a89dabe46831203bbdb7f Mon Sep 17 00:00:00 2001 From: Fede85 Date: Tue, 9 Apr 2013 17:33:43 +0200 Subject: [PATCH] converted to HTTP/1.1 and the client point to the arduino ascii logo --- .../GSM/examples/GsmWebClient/GsmWebClient.ino | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libraries/GSM/examples/GsmWebClient/GsmWebClient.ino b/libraries/GSM/examples/GsmWebClient/GsmWebClient.ino index 8c9e0e96d..e7eb27587 100644 --- a/libraries/GSM/examples/GsmWebClient/GsmWebClient.ino +++ b/libraries/GSM/examples/GsmWebClient/GsmWebClient.ino @@ -2,8 +2,8 @@ Web client This sketch connects to a website through a GSM shield. Specifically, - this example downloads the URL "http://arduino.cc/" and prints it - to the Serial monitor. + this example downloads the URL "http://arduino.cc/asciilogo.txt" and + prints it to the Serial monitor. Circuit: * GSM shield attached to an Arduino @@ -34,7 +34,7 @@ GSM gsmAccess; // URL, path & port (for example: arduino.cc) char server[] = "arduino.cc"; -char path[] = "/"; +char path[] = "/asciilogo.txt"; int port = 80; // port 80 is the default for HTTP void setup() @@ -48,13 +48,13 @@ void setup() Serial.println("Starting Arduino web client."); // connection state boolean notConnected = true; - + // After starting the modem with GSM.begin() // attach the shield to the GPRS network with the APN, login and password while(notConnected) { if((gsmAccess.begin(PINNUMBER)==GSM_READY) & - (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY)) + (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY)) notConnected = false; else { @@ -72,10 +72,10 @@ void setup() // Make a HTTP request: client.print("GET "); client.print(path); - client.println(" HTTP/1.0"); - client.println(); - client.print("HOST: "); + client.println(" HTTP/1.1"); + client.print("Host: "); client.println(server); + client.println("Connection: close"); client.println(); } else @@ -94,7 +94,7 @@ void loop() char c = client.read(); Serial.print(c); } - + // if the server's disconnected, stop the client: if (!client.available() && !client.connected()) {