Question about limitation when get request using sim 800l the link to get request not fully printed

 Serial.println("AT+HTTPPARA=\"URL\",\"https://gps.zidan.smkmhd2pku.sch.id/getstate.php?color=All\"");// setting the httppara, the second parameter is the website you want to access
  Serial.print("AT+HTTPPARA=\"URL\","); //\"https://gps.zidan.smkmhd2pku.sch.id/getstate.php?color=All\"");// setting the httppara, the second parameter is the website you want to access
  Serial.println("\"https://gps.zidan.smkmhd2pku.sch.id/getstate.php?color=All\"");// setting the httppara, the second parameter is the website you want to access

The idea is to send the URL to the SIM800, not the Serial monitor

wait what ?
can you try with
this link https://gpstestering.000webhostapp.com/g.php?color=All

change the Serial to sim800 right ?

can you tell me how you can get fully line printed to your sim 800l
?

Yes, but only send it once. Printing it as a whole then printing it in 2 parts was only to show that it could be done

1 Like

still same

#include <SoftwareSerial.h>

SoftwareSerial sim800(7, 6); // configure software serial port
int REDLed= 11;
int GREENLed= 3;
int BLUELed= 4;

void setup() {     
  
  pinMode(REDLed, OUTPUT);
  pinMode(GREENLed, OUTPUT);
  pinMode(GREENLed, OUTPUT);
  sim800.begin(9600);
  Serial.begin(9600); 
  Serial.print("power up" );
  delay(30000); 
}


 
void loop()
{

  Serial.println("SubmitHttpRequest - started" );
  SubmitHttpRequest();
  Serial.println("SubmitHttpRequest - finished" );
  delay(10000);

}

void SubmitHttpRequest()
{
 
  sim800.println("AT+CSQ"); // Signal quality check

  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.
  
  sim800.println("AT+CGATT?"); //Attach or Detach from GPRS Support
  delay(100);
 
  ShowSerialData();
  sim800.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");//setting the SAPBR, the connection type is using gprs
  delay(1000);
 
  ShowSerialData();
 
  sim800.println("AT+SAPBR=3,1,\"APN\",\"CMNET\"");//setting the APN, Access point name string
  delay(4000);
 
  ShowSerialData();
 
  sim800.println("AT+SAPBR=1,1");//setting the SAPBR
  delay(2000);
 
  ShowSerialData();
 
  sim800.println("AT+HTTPINIT"); //init the HTTP request
 
  delay(2000); 
  ShowSerialData();
 
 
 sim800.print("AT+HTTPPARA=\"URL\","); //\"http://gps.zidan.smkmhd2pku.sch.id/g.php?color=All\"");// setting the httppara, the second parameter is the website you want to access
  sim800.println("\"http://gps.zidan.smkmhd2pku.sch.id/g.php?color=All\"");// setting the httppara, the second parameter is the website you want to access
  delay(1000);
 
  ShowSerialData();
 
  sim800.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(!sim800.available());
 
  ShowSerialData();
 
  sim800.println("AT+HTTPREAD");// read the data from the website you access
  delay(300);
  changeLed();
  ShowSerialData();
 
  sim800.println("");
  delay(100);
}
 
void changeLed()
{
 String content = "";
// String RedState = content.substring();
 while(sim800.available()!=0)
 {  
    //Serial.write(sim800.read());
    content = content + String(char (sim800.read()));
 }
    Serial.println(content);
 if(content.substring(30,31)== "1")
 {
   digitalWrite(REDLed, HIGH);
 }
 else if (content.substring(30,31)== "0")
 {
   digitalWrite(REDLed, LOW);
 }
 
 if(content.substring(31,32)== "1")
 {
   digitalWrite(GREENLed, HIGH);
 }
 else if (content.substring(31,32)== "0")
 {
   digitalWrite(GREENLed, LOW);
 }
 
 if(content.substring(32,33)== "1")
 {
   digitalWrite(BLUELed, HIGH);
 }
 else if (content.substring(32,33)== "0")
 {
   digitalWrite(BLUELed, LOW);
 }
 content = "";
}

 
void ShowSerialData()
{
  while(sim800.available()!=0)
    Serial.write(char (sim800.read()));
}

little bit change of name file in the database

your string is truncated at the 65th character, isn't this related to TX/RX buffer-size issue in SoftwareSerial library ? I am just thinking

but then again, remove 's' from 'https' or else you will end up with 603- DNS error code

yes i have change it to http but the link is not fully printed that the problem
maybe that problem from library i was curious about it but i wanna ask you how you can get fully printed link like that?

try to change software serial RX buffer size ( from 64 to 128 ) and see

mine is at C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial\src\SoftwareSerial.h

anyway you got the response from server now, isn't that what you wanted ?

1 Like

i wanted is get number from the web the link you try is wrong actually
the right one is
https://gpstestering.000webhostapp.com/g.php?color=All

but your code invokes

http://gps.zidan.smkmhd2pku.sch.id/g.php?color=All

yep that wrong link the right link is https://gpstestering.000webhostapp.com/g.php?color=All

well then go ahead and put that link in your code

okey thx for the information if this fixed i will make your reply as solution change the libarary rx buffer from 64 to 128

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.