Forum >How can I send data to a server (HTTP)
How can I send data to a server (HTTP)

Dear all,
I spend most all the afternoon to send data to a web server.
I do have TEL0051 with an Arduino Leonardo
First I would like to know if you have working exemple code. It would be nive
Second, here my try. It alway return me
I think my big worries is to know the order of the cottect at command to send GET to a server!!
Many many many thank
I spend most all the afternoon to send data to a web server.
I do have TEL0051 with an Arduino Leonardo
First I would like to know if you have working exemple code. It would be nive
Second, here my try. It alway return me
Code: Select all
it always return me that on my terminal
void send_HTTP(){ char aux_str[90]; char fix[] = "g=2,195941,4613.161699,N,608.476854,E,1,9,1.398636,435.450073,M,48.200287,M,,0000"; if(debug) Serial.println(F("> Starting sending data")); uint8_t answer=0; Serial.println(strstr(read_AT_string("AT+SAPBR=3,1,\"Contype\",\"GPRS\"", 4000,true),"OK") != NULL); Serial.println(strstr(read_AT_string("AT+SAPBR=3,1,\"APN\",\"intranet\"", 4000,true),"OK") != NULL); Serial.println(strstr(read_AT_string("AT+SAPBR=1,1", 20000,true),"OK") != NULL); // The 3 above line return me 1. Then it sound to be good // Initializes HTTP service if(debug) Serial.println(F("> HTTPINIT")); answer = (strstr(read_AT_string("AT+HTTPINIT", 10000,true),"OK") != NULL); if (answer == 1) { // Sets CID parameter if(debug) Serial.println(F("> AT+HTTPPARA=\"CID\"")); answer = (strstr(read_AT_string("AT+HTTPPARA=\"CID\",1", 2000,true),"OK") != NULL); if (answer == 1) { Serial1.println("AT+HTTPPARA=\"URL\",\"http://bipme.dyndns.org/opt/updatesql.php?g=2,195941,4613.161699,N,608.476854,E,1,9,1.398636,435.450073,M,48.200287,M,,0000\""); delay(10000); //read_AT_string("\"", 1,false); if(debug) Serial.println(F("> AT")); answer = (strstr(read_AT_string("AT", 5000,false),"OK") != NULL); if(debug_buffer) { Serial.println(F("------- Show buffer------")); Serial.println(buffer); Serial.println(F("-------------------------")); } if (answer == 1) { answer = (strstr(read_AT_string("AT+HTTPACTION=0", 40000,false),"+HTTPACTION:0,200") != NULL); if (answer == 1) { if(debug) Serial.println(F(" Done!")); if(debug_buffer) { Serial.println(F("------- Show buffer------")); Serial.println(buffer); Serial.println(F("-------------------------")); } } else { if(debug) Serial.println(F(" Error getting url")); if(debug_buffer) { Serial.println(F("------- Show buffer------")); Serial.println(buffer); Serial.println(F("-------------------------")); } } } else { if(debug) Serial.println(F(" Error setting the url")); } } else { if(debug) Serial.println(F(" Error setting the CID")); } } else { if(debug) Serial.println(F("Error initializating")); } if(strstr(read_AT_string("AT+HTTPTERM", 5000,true),"OK") != NULL); }
Some one, can tell the AT command I have to enter and the order?> Starting sending data
1
1
1
> HTTPINIT
> AT+HTTPPARA="CID"
> AT+HTTPPARA="URL"
> AT
------- Show buffer------
AT+HTTPPARA="URL","http://bipme.dyndns.org/opt/updatesql.php?g=AT
-------------------------
Error setting the url
I think my big worries is to know the order of the cottect at command to send GET to a server!!
Many many many thank
2014-09-15 21:23:02 looks like the quotation mark didn't make it through from the buffer output that you sent. have you checked that? the buffer shows a line without the closing " " mark, perhaps that could be a wrong url.
Jose
