Hi, everyone. I am trying out a small project and trying to send to a remote server based on this tutorial https://how2electronics.com/send-gsm-sim800-900-gprs-data-thingspeak-arduino/
I have changed the APN settings, the host URL command and the GET path command to a simple GET without parameters. Everything seems to go fine but in the end I get a 301 error. Checking my server, i see no incoming request.
The only thing i can think is different is that my host IP is in https while the tutorial IP is in http. Can anyone help with this? Below is my code.
Thank you in advance.
#include <SoftwareSerial.h>
SoftwareSerial gprsSerial(2,3);
#include <String.h>
#include <DHT.h>
#define DHTPIN A0
DHT dht(DHTPIN, DHT11);
void setup()
{
gprsSerial.begin(9600); // the GPRS baud rate
Serial.begin(9600); // the GPRS baud rate
dht.begin();
delay(1000);
}
void loop()
{
float h = dht.readHumidity();
float t = dht.readTemperature();
delay(100);
Serial.print("Temperature = ");
Serial.print(t);
Serial.println(" °C");
Serial.print("Humidity = ");
Serial.print(h);
Serial.println(" %");
if (gprsSerial.available())
Serial.write(gprsSerial.read());
gprsSerial.println("AT");
delay(1000);
gprsSerial.println("AT+CPIN?");
delay(1000);
gprsSerial.println("AT+CREG?");
delay(1000);
gprsSerial.println("AT+CGATT?");
delay(1000);
gprsSerial.println("AT+CIPSHUT");
delay(1000);
gprsSerial.println("AT+CIPSTATUS");
delay(2000);
gprsSerial.println("AT+CIPMUX=0");
delay(2000);
ShowSerialData();
gprsSerial.println("AT+CSTT=\"internet.vodafone.gr\"");//start task and setting the APN,
delay(1000);
ShowSerialData();
gprsSerial.println("AT+CIICR");//bring up wireless connection
delay(3000);
ShowSerialData();
gprsSerial.println("AT+CIFSR");//get local IP adress
delay(2000);
ShowSerialData();
gprsSerial.println("AT+CIPSPRT=0");
delay(3000);
ShowSerialData();
gprsSerial.println("AT+CIPSTART=\"TCP\",\"app.beelive.website\",\"80\"");//start up the connection
delay(6000);
ShowSerialData();
gprsSerial.println("AT+CIPSEND");//begin send data to remote server
delay(4000);
ShowSerialData();
String str="GET https://app.beelive.website/getevents";
Serial.println(str);
gprsSerial.println(str);//begin send data to remote server
delay(4000);
ShowSerialData();
gprsSerial.println((char)26);//sending
delay(5000);//waitting for reply, important! the time is base on the condition of internet
gprsSerial.println();
ShowSerialData();
gprsSerial.println("AT+CIPSHUT");//close the connection
delay(100);
ShowSerialData();
}
void ShowSerialData()
{
while(gprsSerial.available()!=0)
Serial.write(gprsSerial.read());
delay(5000);
}