GPRS Shield receive data from website

Hi friends, this is my first time posting here,

I am trying to put together a project that will read some text from a website and display it on Serial Monitor using GPRS shield V2.0 that i bought from seeedstudio.

This is my Code:

#include <SoftwareSerial.h>
#include <String.h>
 
SoftwareSerial mySerial(7, 8);
 
void setup()
{
  mySerial.begin(19200);               // the GPRS baud rate   
  Serial.begin(19200);    // the GPRS baud rate 
  delay(500);
}
 
void loop()
{
  //after start up the program, you can using terminal to connect the serial of gprs shield,
  //if you input 't' in the terminal, the program will execute SendTextMessage(), it will show how to send a sms message,
  //if input 'd' in the terminal, it will execute DialVoiceCall(), etc.
 
  if (Serial.available())
    switch(Serial.read())
   {
     case 't':
       SendTextMessage();
       break;
     case 'd':
       DialVoiceCall();
       break;
     case 'h':
       SubmitHttpRequest();
       break;
   } 
  if (mySerial.available())
    Serial.write(mySerial.read());
}
 
///SendTextMessage()
///this function is to send a sms message
void SendTextMessage()
{
  mySerial.print("AT+CMGF=1\r");    //Because we want to send the SMS in text mode
  delay(100);
  mySerial.println("AT + CMGS = \"+6285710020395\"");//send sms message, be careful need to add a country code before the cellphone number
  delay(100);
  mySerial.println("nge cek brow !!!");//the content of the message
  delay(100);
  mySerial.println((char)26);//the ASCII code of the ctrl+z is 26
  delay(100);
  mySerial.println();
}
 
///DialVoiceCall
///this function is to dial a voice call
void DialVoiceCall()
{
  mySerial.println("ATD + +6285710020395;");//dial the number
  delay(100);
  mySerial.println();
}
 
///SubmitHttpRequest()
///this function is submit a http request
///attention:the time of delay is very important, it must be set enough 
void SubmitHttpRequest()
{
  mySerial.println("AT+CSQ");
  delay(100);
 
  ShowSerialData();// this code is to show the data from gprs shield, in order to easily see the process of how the gprs shield submit a http request, and the following is for this purpose too.
 
  mySerial.println("AT+CGATT?");
  delay(100);
 
  ShowSerialData();
 
  mySerial.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");//setting the SAPBR, the connection type is using gprs
  delay(1000);
 
  ShowSerialData();
 
  mySerial.println("AT+SAPBR=3,1,\"APN\",\"XL-INTERNET\"");//setting the APN, the second need you fill in your local apn server
  delay(4000);
 
  ShowSerialData();
 
  mySerial.println("AT+SAPBR=1,1");//setting the SAPBR, for detail you can refer to the AT command mamual
  delay(2000);
 
  ShowSerialData();
 
  mySerial.println("AT+HTTPINIT"); //init the HTTP request
 
  delay(2000); 
  ShowSerialData();
 
  mySerial.println("AT+HTTPPARA=\"URL\",\"http://kitaselamanya-d3tt3402.netne.net/runningtext/proses.php?infonya=hello\"");// setting the httppara, the second parameter is the website you want to access
  delay(1000);
 
  ShowSerialData();
 
  mySerial.println("AT+HTTPACTION=0");//submit the request 
  delay(10000);//the delay is very important, the delay time is base on the return from the website, if the return datas are very large, the time required longer.
  //while(!mySerial.available());
 
  ShowSerialData();
 
  mySerial.println("AT+HTTPREAD");// read the data from the website you access
  delay(300);
 
  ShowSerialData();
 
  mySerial.println("");
  delay(100);
}
 
void ShowSerialData()
{
  while(mySerial.available()!=0)
    Serial.write(mySerial.read());
}

The problem I have is, what should i do with the code if i want change this code proses.php?infonya=hello with another info that i input from my website here :
http://kitaselamanya-d3tt3402.netne.net/runningtext

this is the code that i want to change :

mySerial.println("AT+HTTPPARA=\"URL\",\"http://kitaselamanya-d3tt3402.netne.net/runningtext/proses.php?infonya=hello\"");// setting the httppara, the second parameter is the website you want to access
delay(1000);

Any help would be much appreciated. Thank You

Sandi Purnama :slight_smile:

Have you tried splitting up?

char *mytext = "world";
mySerial.print("AT+HTTPPARA=\"URL\",\"http://kitaselamanya-d3tt3402.netne.net/runningtext/proses.php?infonya=\"");
mySerial.print(mytext);
mySerial.println("\"");

Maybe I didn’t understand what your problem is, though.

thank you my friend, you have read and reply my post, very appreciate for you :) Let me tell you the flow,,,

1> i open my website here : http://kitaselamanya-d3tt3402.netne.net/runningtext/ 2> I input Hey Friend 3> it will send to http://kitaselamanya-d3tt3402.netne.net/runningtext/proses.php?infonya=Hey+Friend because i'm using GET Method in my PHP code 4> in my AT+Command code, there is mySerial.println("AT+HTTPPARA=\"URL\",\"http://kitaselamanya-d3tt3402.netne.net/runningtext/proses.php?infonya=VARIABLE THAT I WANT\"");

My problem is what should i do with the AT+Command code if i want get new info every i input new word in http://kitaselamanya-d3tt3402.netne.net/runningtext/

is that wrong with my AT+Command code? Could you give me another way to make it happens?

Thank You

I'm sorry, I don't understand what you want to achieve. In your code you're sending some info to a PHP script on a web server. I did understand that you want to send different content to that script in every call. If that's not your intention please specify what you want to do. And don't assume that I know what you PHP script is doing.