How to use SIM808 http post data to server?

Hello
I have created a GPS logger code using DFRobot SIM808 library. The tcp code and getGPS codes are working fine. but when integrating the both the code, it failed to upload GPS data to my server (IP) . Can anyone please tell me where the problem is?

#include <DFRobot_sim808.h>
#include <SoftwareSerial.h>

#define PIN_TX    8
#define PIN_RX    9
SoftwareSerial mySerial(PIN_TX,PIN_RX);
DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR,

//make sure that the baud rate of SIM900 is 9600!
//you can use the AT Command(AT+IPR=9600) to set it through SerialDebug

//DFRobot_SIM808 sim808(&Serial);

char buffer[512];

void setup(){
  mySerial.begin(9600);
  Serial.begin(9600);

  //******** Initialize sim808 module *************
  while(!sim808.init()) {
      delay(1000);
      Serial.print("Sim808 init error\r\n");
  }
  delay(3000);

  //*********** Attempt DHCP *******************
  while(!sim808.join(F("SIM3g"))) {
      Serial.println("Sim808 join network error");
      delay(2000);
  }

  //************ Successful DHCP ****************
  Serial.print("IP Address is ");
  Serial.println(sim808.getIPAddress());


  //************* Turn on the GPS power************
  if( sim808.attachGPS())
      Serial.println("Open the GPS power success");
  else 
      Serial.println("Open the GPS power failure");
  delay(2000);  
}

void loop(){

  tcp();
  delay(2000);
}


void tcp()
{
    // Update the GPS data
    float lati, longi;
    if (sim808.getGPS()) {
        lati = sim808.GPSdata.lat;
        longi = sim808.GPSdata.lon;
        sim808.detachGPS();
    }
    else {
        // No gps, abort
        return;
    }

    //*********** Establish a TCP connection ************

    if (!sim808.connect(TCP,"103.2.40.50", 80)) {
       Serial.println("Connect error");
       return;
    }
    else {
       Serial.println("Connect mbed.org success");
    }

   //*********** Send a GET request *****************

    char http_cmd[100];
    sprintf(http_cmd, "GET /update?latitude=%f&longitude=%f HTTP/1.0\r\n\r\n\0", lati, longi);
    sim808.send(http_cmd, strlen(http_cmd));

    /*
    int ret = sim808.recv(buffer, sizeof(buffer) - 1);
    if (ret <= 0){
        Serial.println("error receiving");
    }
    else {
        buffer[ret] = '\0';
        Serial.print(buffer);
    }
    */

    //************* Close TCP or UDP connections **********
    sim808.close();

    //*** Disconnect wireless connection, Close Moving Scene *******
    sim808.disconnect();
}

sprintf(http_cmd, "GET /update?latitude=%f&longitude=%f HTTP/1.0\r\n\r\n\0", lati, longi);

What, exactly, is in http_cmd when this function is complete?

Why does your thread title talk about posting data, when you make a GET request? A POST request is completely different.

Hello. How do I make an httpPOST request. Example code please.

this is the edited version and working with thingspeak feild 1 only u want to edit API key and also softserial if need

#include <DFRobot_sim808.h>
#include <SoftwareSerial.h>

//#define PIN_TX 10
//#define PIN_RX 11
//SoftwareSerial mySerial(PIN_TX,PIN_RX);
//DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR,

//make sure that the baud rate of SIM900 is 9600!
//you can use the AT Command(AT+IPR=9600) to set it through SerialDebug

DFRobot_SIM808 sim808(&Serial1);//Im using serial 1 of my arduino mega ,if using other use>(TXpin,RXpin)

char buffer[512];

void setup(){

Serial1.begin(9600);// your serial begin edit if using other
Serial.begin(9600);

while(!sim808.init()) {

delay(1000);

Serial.print(“Sim808 init error\r\n”);

}

delay(3000);

//*********** Attempt DHCP *******************

while(!sim808.join(F(“cmnet”))) {

Serial.println(“Sim808 join network error”);

delay(2000);
}

//************ Successful DHCP ****************

Serial.print("IP Address is ");

Serial.println(sim808.getIPAddress());

//*********** Establish a TCP connection ************

if(!sim808.connect(TCP,“thingspeak.com”, 80)) { // in this line edit the domain name to the name you //are using am using thingspeak,and 80 is the port edit if u want only

Serial.println(“Connect error”);
}
else
{
Serial.println(“Connect thinkspeak success”);

}

//*********** Send a GET request *****************

Serial.println(“waiting to send…”);

int i=230; // i is the variable that u want to send to the server.

String lnk;

lnk=“GET /update?api_key= your key &field1=”+ String(i) +" HTTP/1.0\r\n\r\n";// your key in the position

//Serial.println(lnk); // if u want to see the link made uncomment this

char http_cmd[(lnk.length())+1];

lnk.toCharArray(http_cmd,(lnk.length()+1));

Serial.println(http_cmd); // if u want to see the link made uncomment this

Serial.println(sizeof(http_cmd)); //size of link made

sim808.send(http_cmd,sizeof(http_cmd)-1);

Serial.println(" send… ");

//************* Close TCP or UDP connections **********

sim808.close();

//*** Disconnect wireless connection, Close Moving Scene *******

sim808.disconnect();
}

void loop(){

}