- Fri Oct 10, 2014 12:35 am
#175757
I am using an arduino uno board and I am using an CC3000 board as my wifi module. I tried the GET request using the stream that I made which works perfectly fine. But my problem is that I am having a hard time in using the POST request in the documentation there is only a few information that was given that I should use the link of the total up to the public key only.
This is my public key and private key that I am working on.
http://data.sparkfun.com/input/[publicK ... ial=[value] - I am using this format given to me by the website.
Can anyone help me on this? this code below I am just using trial and error but not able to manage to send it to the stream
This is my public key and private key that I am working on.
http://data.sparkfun.com/input/[publicK ... ial=[value] - I am using this format given to me by the website.
Can anyone help me on this? this code below I am just using trial and error but not able to manage to send it to the stream
Code: Select all
#define WEBSITE "data.sparkfun.com"
const String publicKey = "o8bbjK6n2rH6N08qvN8N";
const String privateKey = "yz008XJwm9Iv8d9yK898";
client.print("POST /input/");
client.print(publicKey);
client.println("Phant-Private-Key: "); // just a trial
client.print(privateKey);
client.println("HTTP/1.1");
client.print(F("Host:"));
client.println(WEBSITE);
client.println(F("Content-Type: application/x-www-form-urlencoded"));
client.println("Connection: close");
client.print(F("Content-Length: "));
client.print(request.length());
client.println();
//Phant-Private-Key: PRIVATE_KEY
//client.print("?private_key=");
client.print("trial=");
client.println(request);
client.println();
Serial.println("Connected & Data sent");