Skip to content

Commit afc9ad2

Browse files
committed
converted to HTTP/1.1 and the client point to the arduino ascii logo
1 parent 34334fc commit afc9ad2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

libraries/GSM/examples/GsmWebClient/GsmWebClient.ino

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
Web client
33
44
This sketch connects to a website through a GSM shield. Specifically,
5-
this example downloads the URL "http://arduino.cc/" and prints it
6-
to the Serial monitor.
5+
this example downloads the URL "http://arduino.cc/asciilogo.txt" and
6+
prints it to the Serial monitor.
77
88
Circuit:
99
* GSM shield attached to an Arduino
@@ -34,7 +34,7 @@ GSM gsmAccess;
3434

3535
// URL, path & port (for example: arduino.cc)
3636
char server[] = "arduino.cc";
37-
char path[] = "/";
37+
char path[] = "/asciilogo.txt";
3838
int port = 80; // port 80 is the default for HTTP
3939

4040
void setup()
@@ -48,13 +48,13 @@ void setup()
4848
Serial.println("Starting Arduino web client.");
4949
// connection state
5050
boolean notConnected = true;
51-
51+
5252
// After starting the modem with GSM.begin()
5353
// attach the shield to the GPRS network with the APN, login and password
5454
while(notConnected)
5555
{
5656
if((gsmAccess.begin(PINNUMBER)==GSM_READY) &
57-
(gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY))
57+
(gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY))
5858
notConnected = false;
5959
else
6060
{
@@ -72,10 +72,10 @@ void setup()
7272
// Make a HTTP request:
7373
client.print("GET ");
7474
client.print(path);
75-
client.println(" HTTP/1.0");
76-
client.println();
77-
client.print("HOST: ");
75+
client.println(" HTTP/1.1");
76+
client.print("Host: ");
7877
client.println(server);
78+
client.println("Connection: close");
7979
client.println();
8080
}
8181
else
@@ -94,7 +94,7 @@ void loop()
9494
char c = client.read();
9595
Serial.print(c);
9696
}
97-
97+
9898
// if the server's disconnected, stop the client:
9999
if (!client.available() && !client.connected())
100100
{

0 commit comments

Comments
 (0)