SOS - GPRS String Getting Truncated

Anyone out there could shine some light!!!, I'm new to coding arduino and I have a problem sending data. for some reason that I cannot figure out, the data, im sending is getting truncated. if any one out there could help I will be greatly appreciated it!!!

This is the code I have and at the end of this post im posting the serial monitor output that shows the data that is getting truncated.

==============================
CODE

//TEMP - Define This Device Hardware Data Input Pins
#define DHTPIN 6 // what pin we're connected to
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
//End TEMP - Define This Device Hardware Data Input Pins
TinyGPS gps;
unsigned char buffer[400];

#define ApiKey "ea7591646d5177e7cfb4ceb50a612ab1"
#define User "email@server"
#define Pin "0"
#define host "server:82"

char ip_d2 = {"
POST /index.php HTTP/1.0\n
Host: "host"\n
Content-Type: application/x-www-form-urlencoded;
"};

char ip_d3 = {"
datastream={"Apeikey":""ApiKey"",\n
"User":""User"",\n
"Pin":""Pin"",\n
"};

const int RX_GPRS = 7;
const int TX_GPRS = 8;
const int RX_GPS = 10;
const int TX_GPS = 11;

//sprintf(ip_d5,"Data":{"Gps":"%s, %s"}}",Apeikey,User,Pin,bufflat,bufflon);
//GPRS - Define This Device Hardware Data Input Pins
SoftwareSerial GPRSinputSerial(RX_GPRS,TX_GPRS);
//GPS - Define This Device Hardware Data Input Pins
SoftwareSerial GPSinputSerial(RX_GPS, TX_GPS); //GPS Data Input
char aux_str[60];
char str_data[80];

float flat, flon;

char bufferlat[10];
char bufferlon[10];

float humidity;
float temperature;
char buffhum [9];//to parse humidity
char bufftemp [9];//to parse temperature

void setup()
{

//Set this to the Baud rate that you will use to monitor the serial monitor window
pinMode(RX_GPRS, INPUT);//7
pinMode(RX_GPS, INPUT);//10
pinMode(TX_GPRS, OUTPUT);//8
pinMode(TX_GPS, OUTPUT);//11
//GPSinputSerial.begin(19200);
Serial.begin(19200);          // the GPRS baud rate 
delay(1000);
Serial.println("Start...");

}

void loop()
{
GPSinputSerial.begin(9600);
GetGPSInfo();
delay(3000);
GetTempHumiInfo();
delay(3000);
GetGPSInfo();
smartdelay(4000);
GPSinputSerial.end();

GPRSinputSerial.begin(19200);
powerUpDown();
delay(5000);
Send2MeBlink();
delay(5000);
powerUpDown();
GPRSinputSerial.end();
} // End Loop

void GetGPSInfo()
{
gps.f_get_position(&flat, &flon);
//Convert flat and flon variable holding Lattitude and Longitude from float to string to be able to assign it to the output string variable for sending it on the data stream
//char bufferlat[10];
dtostrf(flat, 3, 6, bufferlat);
//Convert flon variable holding Lattitude from float to string to be able to sendit on the data stream
//char bufferlon[10];
dtostrf(flon, 3, 6, bufferlon);

smartdelay(5000);
}// End GetGPSInfo() Function

void GetTempHumiInfo()
{
// // Reading temperature or humidity takes about 250 milliseconds!
// // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
humidity = dht.readHumidity();
// // Read temperature as Celsius
temperature = (dht.readTemperature() * 18 + 5)/10 + 32;

dtostrf(humidity, 4, 2, buffhum);
dtostrf(temperature, 4, 2, bufftemp);

}

///Send2MebBlink()
///GPRS function to send the device service data to the MebBlink.com
void Send2MeBlink()
{
GPRSinputSerial.println("AT+CGATT?");
delay(2000);

GPRSShowSerialData();

GPRSinputSerial.println("AT+CSTT="epc.tmobile.com"");//start task and setting the APN,
delay(2000);

GPRSShowSerialData();

GPRSinputSerial.println("AT+CIICR");//bring up wireless connection
delay(3000);

GPRSShowSerialData();

GPRSinputSerial.println("AT+CIFSR");//get local IP adress
delay(2000);

GPRSShowSerialData();

GPRSinputSerial.println("AT+CIPSPRT=0");
delay(3000);

GPRSShowSerialData();

GPRSinputSerial.println("AT+CIPSTART="tcp","server","83"");//start up the connection
delay(2000);

GPRSShowSerialData();

GPRSinputSerial.println("AT+CIPSEND");//begin send data to remote server
delay(4000);
GPRSShowSerialData();

sprintf(str_data,""Data":{"Gps":"%s, %s","Humidity":"%s","Temp":"%s"}}",bufferlat,bufferlon,buffhum,bufftemp);

GPRSinputSerial.println(ip_d2);
delay(500);
GPRSShowSerialData();
sprintf(aux_str,"Content-Length: %d",strlen(ip_d3) + strlen(str_data));
GPRSinputSerial.println(aux_str);
GPRSinputSerial.println("Connection: close");//
delay(500);
GPRSShowSerialData();
GPRSinputSerial.println();
GPRSinputSerial.print(ip_d3);
GPRSinputSerial.println(str_data);
delay(500);
GPRSShowSerialData();

GPRSinputSerial.println();//sending
delay(5000);//waitting for reply, important! the time is base on the condition of internet
GPRSinputSerial.println();

GPRSShowSerialData();

GPRSinputSerial.println("AT+CIPCLOSE");//close the connection
delay(100);
GPRSShowSerialData();
}/// End Send2MebBlink() Function

void powerUpDown()
{
pinMode(9, OUTPUT);
digitalWrite(9,LOW);
delay(2000);
digitalWrite(9,HIGH);
delay(2000);
digitalWrite(9,LOW);
delay(20000); //We wait 20 second to allow the shild to be fully up and registered to the network
}

///GPRSShowSerialData() Function
///this function is to ????????
void GPRSShowSerialData()
{
while(GPRSinputSerial.available()!=0)
Serial.write(GPRSinputSerial.read());
}/// End GPRSShowSerialData() Function

static void smartdelay(unsigned long ms)
{
unsigned long start = millis();
do
{
while (GPSinputSerial.available())
gps.encode(GPSinputSerial.read());
} while (millis() - start < ms);
}/// End smartdelay() Function

====================================================
SERIAL MONITOR OUTPUT

23:14:57.789 -> Start...
23:15:48.794 -> `⸮⸮⸮⸮
23:15:48.794 -> RDY
23:15:48.794 ->
23:15:48.794 -> +CFUN: 1
23:15:48.794 ->
23:15:48.794 -> +CPIN: READY
23:15:48.840 ->
23:15:48.840 -> +PACSP: 1
23:15:48.840 ->
23:15:48.840 -> Call ReaAT+CSTT="server"
23:15:50.834 ->
23:15:50.834 -> OK
23:15:53.823 -> AT+CIICR
23:15:53.823 ->
23:15:53.823 -> OK
23:15:55.824 -> AT+CIFSR
23:15:55.824 ->
23:15:55.824 -> 26.110.12.110
23:15:58.847 -> AT+CIPSPRT=0
23:15:58.847 ->
23:15:58.847 -> OK
23:16:00.873 -> AT+CIPSTART="tcp","server","83"
23:16:00.873 ->
23:16:00.873 -> OK
23:16:04.866 -> AT+CIPSEND
23:16:04.866 ->
23:16:04.866 -> ERROR
23:16:04.866 ->
23:16:04.866 -> CONNECT OK
23:16:05.394 -> POST /index.php HTTP/1.0
23:16:05.439 -> Host: server:82
23:16:05.439 -> ContentContent-Length: 165
23:16:05.967 -> Connection: close
23:16:06.546 ->
23:16:06.546 -> datastream={"Apeikey":"ea7591646d5177e7cfb4ceb50a612ab1",
23:16:06.546 -> "Us <<<=== DATA STRING GETTING TRUNCATED HERE
23:16:11.650 ->
23:16:11.650 -> AT+CIPCLOSE

Hello, do yourself a favour and please read How to get the best out of this forum and modify your post accordingly (including code tags and necessary documentation of your ask).

+++++

Using multiple software serial and adding delays and expecting good results is wishful thinking

Get a MEGA or a board with enough hardware serial ports

Looks like the problem happens between sending the CIPSEND command and sending 'ip_d2'. Between those is a call to sprintf() into 'str_data' which is 80 characters long.. Are you sure your line is shorter than 80 characters? if not, you are writing off the end of 'str_data' and corrupting memory.

  GPRSinputSerial.println("AT+CIPSEND");//begin send data to remote server
  delay(4000);
  GPRSShowSerialData();

  sprintf(str_data, "\"Data\":{\"Gps\":\"%s,%s\",\"Humidity\":\"%s\",\"Temp\":\"%s\"}}", bufferlat, bufferlon, buffhum, bufftemp);

  GPRSinputSerial.println(ip_d2);
  delay(500);
  GPRSShowSerialData();

Maybe the input buffer is overflowing? You put in a delay and then call GPRSShowSerialData() to get the data from the buffer. Rather than:

  delay(5000);
  GPRSShowSerialData();

You could change GPRSShowSerialData(); to take a timeout value:
GPRSShowSerialData(500);

///GPRSShowSerialData(timeout) Function
///this function is to ????????
void GPRSShowSerialData(unsigned long timeout)
{
  unsigned long start = millis();
  while (millis() - start < timeout)
    if (GPRSinputSerial.available() != 0)
      Serial.write(GPRSinputSerial.read());
}/// End GPRSShowSerialData() Function

Hi Jackson, thanks for pointing me to that article about how to make the best of the forum. Was very helpful. the multiple delays were causing the issue. as soon as I change the code to reflect the functions that johnwasser told me the string started showing in full. just have a minor glitch now. thanks for all your help

Hi John, I really appreciate the help you gave me, thanks you! The delays were causing the issue and as soon as I changed the function as you recommended, the string started to show correctly. I just have one minor issue in one of the variables for on my datastream. The following is the serial monitor output around the area where I have the issue. Notice after {"Gps":" im missing the Lattitude, longitude is showing fine and all the other data.

{"Gps":", -80.398483","Humidity":"156.80","Temp":"55.90"}}

This is the actual code, I used serial.println to check ont eh and the varaible (dtostrf(flat, 3, 6, bufferlat)) that converts the value and is getting the value correcly but when build the string and i replace with %s it does not show {"Gps":"%s longiturded is showing good. Sorry if my terminology is not good, i'm not a full time programmer but Im trying to learn more as i go.

 sprintf(str_data, "\"Data\":{\"Gps\":\"%s, %s\",\"Humidity\":\"%s\",\"Temp\":\"%s\"}}", bufferlat, bufferlon, buffhum, bufftemp);

The full new code with your suggestions and the output from the serial monitor at the end:


/* 
   NEW CODE

   DESCRIPTION:
   Device that collects GPS coordinates as well as Humidity/Temperature from a sensor
   and sends the data to a server using TCP protocol via GPRS shield

   BOARD:
   BN: Arduino Uno
   VID: 2341
   PID: 0043
   
   SHIELDS:
   SIM900 Quad-Band GPRS shield
   http://wiki.epalsite.com/index.php?title=SIM900_Quad-Band_GPRS_shield

   MODULES:
   Y-NEO6MV2 Flight Controller GPS - MODEL: 1575R-A
   https://www.cheap-drones.com/gy-neo6mv2-flight-controller-gps-module-for-arduino-mwc/

   DHT11 Temperature Humidity Sensor Module Digital Temperature Humidity Sensor 3.3V-5V
   https://www.amazon.com/gp/product/B07WT2HJ4F/ref=ox_sc_act_title_1?smid=A2Z10KY0342329&psc=1

*/

#include <SoftwareSerial.h>
#include <TinyGPS.h> // For GPS Module
#include "DHT.h" //For Temp module
//TEMP - Define This Device Hardware Data Input Pins
   #define DHTPIN 6     // what pin we're connected to
   #define DHTTYPE DHT11   // DHT 11 
   DHT dht(DHTPIN, DHTTYPE);      
//End TEMP - Define This Device Hardware Data Input Pins
TinyGPS gps;



#define  ApiKey "xxxxxxxxxxxxxxxxxx"
#define  User "email@email.com"
#define  Pin "0"
#define host "server"

char ip_d2[]  = {"\
POST /index.php HTTP/1.0\n\
Host: "host"\n\
Content-Type: application/x-www-form-urlencoded;\
"};

char ip_d3[]  = {"datastream={\"Apeikey\":\""ApiKey"\",\"User\":\""User"\",\"Pin\":\""Pin"\","};

const int RX_GPRS = 7;
const int TX_GPRS = 8;
const int RX_GPS = 10;
const int TX_GPS = 11;


//GPRS - Define This Device Hardware Data Input Pins
SoftwareSerial GPRSinputSerial(RX_GPRS,TX_GPRS);
//GPS - Define This Device Hardware Data Input Pins
SoftwareSerial GPSinputSerial(RX_GPS, TX_GPS);   //GPS Data Input 
char aux_str[60];
char str_data[80];

float flat, flon;

char bufferlat[10];
char bufferlon[10];

float humidity;
float temperature;
char buffhum [9];//to parse humidity
char bufftemp [9];//to parse temperature

void setup()
{
 
   //Set this to the Baud rate that you will use to monitor the serial monitor window
   pinMode(RX_GPRS, INPUT);//7
   pinMode(RX_GPS, INPUT);//10
   pinMode(TX_GPRS, OUTPUT);//8
   pinMode(TX_GPS, OUTPUT);//11
   //GPSinputSerial.begin(19200);
   Serial.begin(19200);          // the GPRS baud rate 
   delay(1000);
   Serial.println("Start...");
   
}



void loop()
{  
 GPSinputSerial.begin(9600);
 GetGPSInfo();
 delay(3000);
 GetTempHumiInfo();
 delay(3000);
 GetGPSInfo();
 smartdelay(4000);
 GPSinputSerial.end();  

 GPRSinputSerial.begin(19200);
// powerUpDown();
// delay(5000);
 Send2MeBlink();
 //delay(5000);
 //powerUpDown();   
 GPRSinputSerial.end();    
} // End Loop


void GetGPSInfo() 
{   
 gps.f_get_position(&flat, &flon);
 //Convert flat and flon variable holding Lattitude and Longitude from float to string to be able to assign it to the output string variable for sending it on the data stream

dtostrf(flat, 3, 6, bufferlat);  
 //Convert flon variable holding Lattitude from float to string to be able to sendit on the data stream

 dtostrf(flon, 3, 6, bufferlon);
  
 smartdelay(5000);
}// End GetGPSInfo() Function

void GetTempHumiInfo()
{
   // // Reading temperature or humidity takes about 250 milliseconds!
     humidity = dht.readHumidity();
   // // Read temperature as Celsius
   temperature = (dht.readTemperature() * 18 + 5)/10 + 32;

   dtostrf(humidity, 4, 2, buffhum);
   dtostrf(temperature, 4, 2, bufftemp);

}

///Send2MebBlink()
///GPRS function to send the device service data to the MebBlink.com
void Send2MeBlink()
{
 GPRSinputSerial.println("AT+CGATT?");

 GPRSShowSerialData(1000);

 //GPRSinputSerial.println("AT+CSTT=\"CMNET\"");//start task and setting the APN,
 GPRSinputSerial.println("AT+CSTT=\"epc.tmobile.com\"");//start task and setting the APN,

  
 GPRSShowSerialData(1000);

 GPRSinputSerial.println("AT+CIICR");//bring up wireless connection

 GPRSShowSerialData(1000);

 GPRSinputSerial.println("AT+CIFSR");//get local IP adress

 GPRSShowSerialData(1000);

 //GPRSinputSerial.println("AT+CIPSPRT=0");
 //GPRSShowSerialData(3000);

 GPRSinputSerial.println("AT+CIPSTART=\"TCP\",\"server\",\"83\"");//start up the connection
 GPRSShowSerialData(1000);

 GPRSinputSerial.println("AT+CIPSEND");//begin send data to remote server
 GPRSShowSerialData(100);

 sprintf(str_data,"\"Data\":{\"Gps\":\"%s, %s\",\"Humidity\":\"%s\",\"Temp\":\"%s\"}}",bufferlat,bufferlon,buffhum,bufftemp);

 GPRSinputSerial.println(ip_d2);

 GPRSShowSerialData(500);
 sprintf(aux_str,"Content-Length: %d",strlen(ip_d3) + strlen(str_data));
 GPRSinputSerial.println(aux_str);
 GPRSinputSerial.println("Connection: close");//

 GPRSShowSerialData(500);
 GPRSinputSerial.println();
 GPRSinputSerial.print(ip_d3);
 GPRSinputSerial.println(str_data);

 GPRSShowSerialData(500); 
 
 GPRSinputSerial.println();//sending
 GPRSShowSerialData(500);
 
  GPRSinputSerial.println((char)26);//the ASCII code of the ctrl+z is 26
  GPRSShowSerialData(500);
  
 GPRSinputSerial.println("AT+CIPCLOSE");//close the connection

 GPRSShowSerialData(100);
}/// End Send2MebBlink() Function

void powerUpDown()
{
 pinMode(9, OUTPUT); 
 digitalWrite(9,LOW);
 delay(2000);
 digitalWrite(9,HIGH);
 delay(2000);
 digitalWrite(9,LOW);
 delay(20000); //We wait 20 second to allow the shild to be fully up and registered to the network
} 

///GPRSShowSerialData() Function
///this function is to ????????
///GPRSShowSerialData(500) Function
///this function is to ????????
void GPRSShowSerialData(unsigned long timeout)
{
 unsigned long start = millis();
 while (millis() - start < timeout)
   if (GPRSinputSerial.available() != 0)
     Serial.write(GPRSinputSerial.read());
}/// End GPRSShowSerialData() Function


static void smartdelay(unsigned long ms)
{
 unsigned long start = millis();
 do 
 {
   while (GPSinputSerial.available())
     gps.encode(GPSinputSerial.read());
 } while (millis() - start < ms);
}/// End smartdelay() Function

SERIAL MONITOR OUTPUT:

GATT: 1

OK
AT+CSTT="MOBILENET"

ERROR
AT+CIICR

ERROR
AT+CIFSR

21.88.243.142
AT+CIPSTART="TCP","server","83"

OK

CONNECT OK
AT+CIPSEND

> POST /index.php HTTP/1.0
Host: server
Content-Type: application/x-www-form-urlencoded;
Content-Length: 165
Connection: close

datastream={"Apeikey":"e2abxxxxxxxxxxxxxxx77cfb4cebxxxx","User":"email@email.com","Pin":"0","Data":{"Gps":", -80.398483","Humidity":"156.80","Temp":"55.90"}}


AT+CIPCLOSE

That 'bufferlon' string is 11 characters long when you include the terminator. You only allocated 10 characters for 'bufferlon'!

My guess is that something similar is happening elsewhere and 'bufferlat' is getting overwritten. Check that NONE of your string operations overflow the buffer! I think there is an 'snprintf()' where you specify the size of the buffer so the function knows enough not to overrun.

Great!!! I change them to 11 characters long and works like a charm, all the string is complete now.

datastream={"Apeikey":"xxxxxxxxxxxxxxxxxx","User":"email@email.com","Pin":"0","Data":{"Gps":"26.051762, -80.398415","Humidity":"156.80","Temp":"55.90"}}

But something strange happens thought, after is running for a long time, I loose the values for the temperature and humidity from the DHT11 Temperature Humidity Sensor they show as NAN. I even change the sensor to make sure it was not bad and same thing. The GPS values are steady. If i re-upload the program again without power off the shield and Arduino the problem persist. I have to disconnect the USB and and power it off completely and then reconnect and powerup again and the i runs good again with the correct values readings from the DH11.
This is what I get after about 15 - 20 minutes of running:

datastream={"Apeikey":"xxxxxxxxxxxxxxxxxx","User":"email@email.com","Pin":"0","Data":{"Gps":"26.051727, -80.398293","Humidity":" NAN","Temp":" NAN"}}

Could it be the DHT11 Sensor overheating and malfunctioning? I even added a function i found to clear the buffer that I found but same issue with the NAN. So run ok for about 15 -20 mins then begin randomly giving NAN then suddenly give NAN all the time after the 15 -20 mins. here is 2 screenshot of the log Screenshot by Lightshot this one was after I reset power unplug the usb Screenshot by Lightshot

Another thing I notice is that when the problem begins to happen the value for the humidity goes down from the regular 156 all the way to like 7 sometimes 9 and 10 and there is really no change cause im inside with AC

This is the last version of the code, Thank you again for helping me!!:

 /* 
    DESCRIPTION:
    Device that collects GPS coordinates as well as Humidity/Temperature from a sensor
    and sends the data to a server using TCP protocol via GPRS shield

    

    BOARD:
    BN: Arduino Uno
    VID: 2341
    PID: 0043
    
    SHIELDS:
    SIM900 Quad-Band GPRS shield
    http://wiki.epalsite.com/index.php?title=SIM900_Quad-Band_GPRS_shield

    MODULES:
    Y-NEO6MV2 Flight Controller GPS - MODEL: 1575R-A
    https://www.cheap-drones.com/gy-neo6mv2-flight-controller-gps-module-for-arduino-mwc/

    DHT11 Temperature Humidity Sensor Module Digital Temperature Humidity Sensor 3.3V-5V
    https://www.amazon.com/gp/product/B07WT2HJ4F/ref=ox_sc_act_title_1?smid=A2Z10KY0342329&psc=1

 */

#include <SoftwareSerial.h>
#include <TinyGPS.h> // For GPS Module
#include "DHT.h" //For Temp module
//TEMP - Define This Device Hardware Data Input Pins
    #define DHTPIN 6     // what pin we're connected to
    #define DHTTYPE DHT11   // DHT 11 
    DHT dht(DHTPIN, DHTTYPE);      
//End TEMP - Define This Device Hardware Data Input Pins

TinyGPS gps;

//Vars for For clea buffer funtion
byte buffer[64]; // buffer array for data recieve over serial port
int count=0;     // counter for buffer array 
 
#define  ApiKey "xxxxxxxxxxxx"
#define  User "email@email.com"
#define  Pin "0"
#define host "server"

char ip_d2[]  = {"\
POST /index.php HTTP/1.0\n\
Host: "host"\n\
Content-Type: application/x-www-form-urlencoded;\
"};

char ip_d3[]  = {"datastream={\"Apeikey\":\""ApiKey"\",\"User\":\""User"\",\"Pin\":\""Pin"\","};

const int RX_GPRS = 7;
const int TX_GPRS = 8;
const int RX_GPS = 10;
const int TX_GPS = 11;

 
//GPRS - Define This Device Hardware Data Input Pins
SoftwareSerial GPRSinputSerial(RX_GPRS,TX_GPRS);
//GPS - Define This Device Hardware Data Input Pins
SoftwareSerial GPSinputSerial(RX_GPS, TX_GPS);   //GPS Data Input 
char aux_str[60];
char str_data[80];

float flat, flon;

char bufferlat[11];
char bufferlon[11];

float humidity;
float temperature;
char buffhum [9];//to parse humidity
char bufftemp [9];//to parse temperature

void setup()
{
  
    //Set this to the Baud rate that you will use to monitor the serial monitor window
    pinMode(RX_GPRS, INPUT);//7
    pinMode(RX_GPS, INPUT);//10
    pinMode(TX_GPRS, OUTPUT);//8
    pinMode(TX_GPS, OUTPUT);//11
    //GPSinputSerial.begin(19200);
    Serial.begin(19200);          // the GPRS baud rate 
    delay(1000);
    Serial.println("Start...");
    
}
 
 
 
void loop()
{  
  GPSinputSerial.begin(9600);
  GetGPSInfo();
  delay(3000);
  GetTempHumiInfo();
  delay(3000);
  GetGPSInfo();
  smartdelay(4000);
  GPSinputSerial.end();  

  GPRSinputSerial.begin(19200);
 // powerUpDown();
 // delay(5000);
  Send2MeBlink();
  //delay(5000);
  //powerUpDown();   
  GPRSinputSerial.end();    
} // End Loop


 void GetGPSInfo() 
 {   
gps.f_get_position(&flat, &flon);
  //Convert flat and flon variable holding Lattitude and Longitude from float to string to be able to assign it to the output string variable for sending it on the data stream
  //char bufferlat[10];
 dtostrf(flat, 3, 6, bufferlat);  
 //Serial.println(dtostrf(flat, 3, 6, bufferlat)); 
  //Convert flon variable holding Lattitude from float to string to be able to sendit on the data stream
  //char bufferlon[10];
  dtostrf(flon, 3, 6, bufferlon);
   
  smartdelay(5000);
}// End GetGPSInfo() Function

void GetTempHumiInfo()
{
    // // Reading temperature or humidity takes about 250 milliseconds!
    // // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
    humidity = dht.readHumidity();
    // // Read temperature as Celsius
    temperature = (dht.readTemperature() * 18 + 5)/10 + 32;
    
    Serial.println(dht.readHumidity()); 
    Serial.println(dht.readTemperature()); 
    
    dtostrf(humidity, 4, 2, buffhum);
    dtostrf(temperature, 4, 2, bufftemp);
 
}

///Send2MebBlink()
///GPRS function to send the device service data to the MebBlink.com
void Send2MeBlink()
{
  GPRSinputSerial.println("AT+CGATT?");
 
  GPRSShowSerialData(1000);
 
  //GPRSinputSerial.println("AT+CSTT=\"CMNET\"");//start task and setting the APN,
  GPRSinputSerial.println("AT+CSTT=\"server\"");//start task and setting the APN,

   
  GPRSShowSerialData(1000);
 
  GPRSinputSerial.println("AT+CIICR");//bring up wireless connection
 
  GPRSShowSerialData(1000);
 
  GPRSinputSerial.println("AT+CIFSR");//get local IP adress
 
  GPRSShowSerialData(1000);
 
  GPRSinputSerial.println("AT+CIPSTART=\"TCP\",\"server\",\"83\"");//start up the connection
  GPRSShowSerialData(1000);

  GPRSinputSerial.println("AT+CIPSPRT=1");
  GPRSShowSerialData(500);

  GPRSinputSerial.println("AT+CIPSEND");//begin send data to remote server
  GPRSShowSerialData(100);
 
  sprintf(str_data,"\"Data\":{\"Gps\":\"%s, %s\",\"Humidity\":\"%s\",\"Temp\":\"%s\"}}",bufferlat,bufferlon,buffhum,bufftemp);

  GPRSinputSerial.println(ip_d2);

  GPRSShowSerialData(500);
  sprintf(aux_str,"Content-Length: %d",strlen(ip_d3) + strlen(str_data));
  GPRSinputSerial.println(aux_str);
  GPRSinputSerial.println("Connection: close");//

  GPRSShowSerialData(500);
  GPRSinputSerial.println();
  GPRSinputSerial.print(ip_d3);
  GPRSinputSerial.println(str_data);

  GPRSShowSerialData(500); 
  
  GPRSinputSerial.println();//sending
  GPRSShowSerialData(500);
  
   GPRSinputSerial.println((char)26);//the ASCII code of the ctrl+z is 26
   GPRSShowSerialData(500);
   
  GPRSinputSerial.println("AT+CIPCLOSE");//close the connection

  GPRSShowSerialData(100);

  GetBuffer();
    
}/// End Send2MebBlink() Function
 
void powerUpDown()
{
  pinMode(9, OUTPUT); 
  digitalWrite(9,LOW);
  delay(2000);
  digitalWrite(9,HIGH);
  delay(2000);
  digitalWrite(9,LOW);
  delay(20000); //We wait 20 second to allow the shild to be fully up and registered to the network
} 

///GPRSShowSerialData() Function
///this function is to ????????
///GPRSShowSerialData(500) Function
///this function is to ????????
void GPRSShowSerialData(unsigned long timeout)
{
  unsigned long start = millis();
  while (millis() - start < timeout)
    if (GPRSinputSerial.available() != 0)
      Serial.write(GPRSinputSerial.read());
}/// End GPRSShowSerialData() Function


static void smartdelay(unsigned long ms)
{
  unsigned long start = millis();
  do 
  {
    while (GPSinputSerial.available())
      gps.encode(GPSinputSerial.read());
  } while (millis() - start < ms);
}/// End smartdelay() Function


void clearBufferArray()              // function to clear buffer array
{
  for (int i=0; i<count;i++)
    { buffer[i]=NULL;}                  // clear all index of array with command NULL
}
void GetBuffer()
{
  if (GPRSinputSerial.available())              // if date is comming from softwareserial port ==> data is comming from gprs shield
  {
    while(GPRSinputSerial.available())          // reading data into char array 
    {
      buffer[count++]=GPRSinputSerial.read();     // writing data into array
      if(count == 64)break;
  }
      Serial.write(buffer,count);            // if no data transmission ends, write buffer to hardware serial port
      clearBufferArray();              // call clearBufferArray function to clear the storaged data from the array
    count = 0; 
  }
}

I did some test and singled out with totally different code just with the DHT11 sensor and GPS sensor . if I ran the DHT11 sensor alone without initializing the xxx, the it runs perfect, but as soon as I uncomment the following line the issue begins, even if I have the GPS loop commented out.

  // ss.begin(9600); // GPS BEGIN

the gps the problem happens sporadically, is almost like once you enable the software serial library all breaks

FULL CODE THAT I USED FOR THE TEST:

      //BEGIN INCLUDES TEMPERATURE 
      #include "DHT.h"
      //END  INCLUDES TEMPERATURE



              //BEGIN INCLUDES TEMPERATURE 
              #include <SoftwareSerial.h>
              #include <TinyGPS.h> // For GPS Module
              //END INCLUDES TEMPERATURE 


      //BEGIN DEFINE TEMPERATURE
      #define DHTPIN 6     // what pin we're connected to
      
      #define DHTTYPE DHT11   // DHT 11 
      //#define DHTTYPE DHT22   // DHT 22  (AM2302)
      //#define DHTTYPE DHT21   // DHT 21 (AM2301)
      
   
      // Initialize DHT sensor for normal 16mhz Arduino
      DHT dht(DHTPIN, DHTTYPE);

       //END DEFINE TEMPERATURE



              //BEGIN DEFINE GPS 
              //GPS Values Info http://aprs.gids.nl/nmea/
                  TinyGPS gps;
                  SoftwareSerial ss(10, 11); //TX,RX (receive data  module, send data to module)
                  
                  static void smartdelay(unsigned long ms);
                  static void print_float(float val, float invalid, int len, int prec);
                  static void print_int(unsigned long val, unsigned long invalid, int len);
                  static void print_date(TinyGPS &gps);
                  static void print_str(const char *str, int len);
              //END DEFINE GPS 



void setup() {
  
 //BEGIN SETUP  

      Serial.println("Begin Setup!");
      
      Serial.begin(9600); 
      dht.begin();  // TEMPERATURE BEGIN


     // ss.begin(9600); // GPS BEGIN

 //END SETUP 
  
}




void loop() {
  
      //BEGIN LOOP TEMPERATURE 
      // Wait a few seconds between measurements.
      //delay(2000);
    
      // Reading temperature or humidity takes about 250 milliseconds!
      // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
      float h = dht.readHumidity();
      // Read temperature as Celsius
      float t = dht.readTemperature();
      // Read temperature as Fahrenheit
      float f = dht.readTemperature(true);
      
      // Check if any reads failed and exit early (to try again).
      if (isnan(h) || isnan(t) || isnan(f)) {
        Serial.println("Failed to read from DHT sensor!");
        return;
      }
    
      // Compute heat index
      // Must send in temp in Fahrenheit!
      float hi = dht.computeHeatIndex(f, h);
    
      Serial.print("Humidity: "); 
      Serial.print(h);
      Serial.print(" %\t");
      
      Serial.print("Temperature: "); 
      Serial.print(t);
      Serial.print(" *C ");
      
      Serial.print(f);
      Serial.print(" *F\t");
      
      Serial.print("Heat index: ");
      Serial.print(hi);
      Serial.println(" *F");
      //END LOOP TEMPERATURE 
 
      Serial.println();
      
//            //BEGIN LOOP GPS
//              float flat, flon;
//              gps.f_get_position(&flat, &flon);
//              print_float(flat, TinyGPS::GPS_INVALID_F_ANGLE, 10, 6);
//              print_float(flon, TinyGPS::GPS_INVALID_F_ANGLE, 11, 6);
//              //END  LOOP GPS



}



//BEGIN TEMPERATURE FUNCTIONS


          
//END TEMPERATURE FUNCTIONS




 

//BEGIN GPS FUNCTIONS
          static void smartdelay(unsigned long ms)
          {
            unsigned long start = millis();
            do 
            {
              while (ss.available())
                gps.encode(ss.read());
            } while (millis() - start < ms);
          }
          
          static void print_float(float val, float invalid, int len, int prec)
          {
            if (val == invalid)
            {
              while (len-- > 1)
                Serial.print('*');
                Serial.print(' ');
            }
            else
            {
              Serial.print(val, prec);
              int vi = abs((int)val);
              int flen = prec + (val < 0.0 ? 2 : 1); // . and -
              flen += vi >= 1000 ? 4 : vi >= 100 ? 3 : vi >= 10 ? 2 : 1;
              for (int i=flen; i<len; ++i)
              Serial.print(' ');
            }
                smartdelay(0);
              }
          
          static void print_int(unsigned long val, unsigned long invalid, int len)
          {
            char sz[32];
            if (val == invalid)
              strcpy(sz, "*******");
            else
              sprintf(sz, "%ld", val);
            sz[len] = 0;
            for (int i=strlen(sz); i<len; ++i)
              sz[i] = ' ';
            if (len > 0) 
              sz[len-1] = ' ';
             Serial.print(sz);
            smartdelay(0);
          }
          
           static void print_date(TinyGPS &gps)
          {
            int year;
            byte month, day, hour, minute, second, hundredths;
            unsigned long age;
            gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths, &age);
            if (age == TinyGPS::GPS_INVALID_AGE)
              Serial.print("********** ******** ");
            else
            {
              char sz[32];
              sprintf(sz, "%02d/%02d/%02d %02d:%02d:%02d ",
                  month, day, year, hour, minute, second);
              Serial.print(sz);
            }
            print_int(age, TinyGPS::GPS_INVALID_AGE, 5);
                smartdelay(0);
               }
          
          static void print_str(const char *str, int len)
          {
            int slen = strlen(str);
            for (int i=0; i<len; ++i)
              Serial.print(i<slen ? str[i] : ' ');
                smartdelay(0);
              }
              
//END GPS FUNTIONS

You should put the .begin() before the .println()

Can you describe 'the issue' or 'the GPS problem' in less vague terms? What are the symptoms? What is shown in Serial Monitor?

The GPS works fine now , the problem is that I have a temperature/humidity sensor and after I have the aruino running for about 10-15 minutes the values of the temperature/humidity sensor get lost and change to the value of NAN and this is what show on the serial monitor:

datastream={"Apeikey":"xxxxxxxxxxxxxxxxxx","User":"email@email.com","Pin":"0","Data":{"Gps":"26.051727, -80.398293","Humidity":" NAN","Temp":" NAN"}}

if I turn off the Arduino with the GPRS shield completely and then turn it back, i start getting good values for temperature and humidty sensor, then after about 10-15 minutes again I loose the values and go back to NAN. The GPS does show properly all the time.

Do you ever get the "Failed to read from DHT sensor!" message in your Serial Monitor? If so, the 'return;' means that nothing past that point will be executed, including the GPS stuff. Perhaps your CHT sensor is failing or has a bad connection.