i have changed this as below:
#include <SoftwareSerial.h>
//#include "test_4july.h"
SoftwareSerial myGsm(2,3);
char frame[200];
char aux_str[30];
char latitude[15];
int longitude = 2;
int altitude = 3;
//char url[] = "https://devanshipatel.000webhostapp.com/vts/vts/get_link.php";
void setup()
{
myGsm.begin(9600);
Serial.begin(9600);
delay(500);
// myGsm.println("AT+CGPSIPR=9600");
// delay(200);
// printSerialData();
// myGsm.println("AT+CGPSPWR=1");
// delay(200);
// printSerialData();
//
// myGsm.println("AT+CGATT=1");
// delay(200);
// printSerialData();
myGsm.println("AT+CGATT=1");
delay(200);
printSerialData();
//set up GPRS, connection type
myGsm.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");
delay(1000);
printSerialData();
// Handle the APN
myGsm.println("AT+SAPBR=3,1,\"APN\",\"UninorGPRS\"");
delay(1000);
printSerialData();
//tries to connect to GPRS
//myGsm.println("AT+SAPBR=1,1"); //Enable bearer 1
//delay(200);
//printSerialData();
myGsm.println("AT+SAPBR=2,1"); //Check whether bearer 1 is open
delay(200);
printSerialData();
// initialise embedded HTTP ruttine
myGsm.println("AT+HTTPINIT");
delay(2000);
printSerialData();
// set the HTTP session
myGsm.println("AT+HTTPPARA=\"CID\",1");
delay(1000);
printSerialData();
// set the HTTP URL
myGsm.println("AT+HTTPPARA=\"URL\",\"http://www.drpinventions.com/get_link.php?latitude=2\"");
printSerialData();
// start the session
myGsm.println("AT+HTTPACTION=0");
delay(10000);
printSerialData();
// read the data from the HTTP server
myGsm.println("AT+HTTPREAD");
delay(1000);
// that's because you have a crapy way of reading the Serial line..
// an attempt to read for a bit longer
//for (int i=0; i<100; i++) {
// printSerialData();
// delay(1);
//}
// ends the connexion with the HTTP server
myGsm.println("AT+HTTPTERM");
delay(100);
myGsm.println();
printSerialData();
}
void loop()
{
}
void printSerialData()
{
const unsigned long timeout = 2000ul;
unsigned long startChrono = millis();
while (millis() - startChrono <= timeout) {
if (myGsm.available()) {
Serial.write(myGsm.read());
startChrono = millis(); // reset the timeOut
}
delayMicroseconds(10); // sometimes Sofwtare Serial does not like banging at it too fast
}
}
and serial monitor output is as below:
still not getting anything on webpage....
AT+CGATT=1
OK
AT+SAPBR=3,1,"APN","UninorGPRS"
OK
AT+SAPBR=1,1
OK
AT+SAPBR=2,1
+SAPBR: 1,1,"10.84.2.242"
OK
AT+HTTPINIT
OK
AT+HTTPPARA="CID",1
OK
AT+HTTPPARA="URL","http://www.drpinventions.com/get_link.php?latitude=2"
OK
AT+HTTPACTION=0
OK
AT+HTTPREAD
OK
+HTTPACTION:0,200,2226
AT+HTTPTERM
OK
