Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // arduino to google spreadsheet
- #include <Ethernet.h>
- #include <Client.h>
- #include <Server.h>
- byte mac[] = { 0x00,0x50,0xC2,0x97,0x21,0xD2};
- byte ip[] = { 192,168,1,254};
- byte subnet[] = { 255,255,255,0};
- byte gateway[] = { 192,168,1,1};
- byte server[] = { 64, 233, 183, 100 }; // spreadsheets.google.com
- Client client(server, 80);
- void setup()
- {
- Ethernet.begin(mac, ip , gateway , subnet);
- delay(1000);
- char body[] = "entry.1.single=arduino0001&submit=Submit";
- if (client.connect()) {
- client.println("POST /formResponse?formkey=dG5pUF9za3NBYWVTblNMc3FxOGxsWHc6MA&ifq HTTP/1.1");
- client.println("Host: spreadsheets.google.com");
- client.println("Content-Type: application/x-www-form-urlencoded");
- client.print("Content-Length: ");
- client.println(sizeof(body),DEC);
- client.println();
- client.println(body);
- }
- delay(1000);
- client.stop();
- }
- void loop()
- {
- if (client.available()) {
- char c = client.read();
- }
- if (!client.connected()) {
- client.stop();
- for(;;)
- ;
- }
- }
Add Comment
Please, Sign In to add comment