I am having a problem uploading data to my web server using GPRS. I have a php script which updates a database. When I call the script from a browser address line the script runs perfectly. When I call it using tcp GET the code runs through ok with all valid replies from GPRS but the web server doesn't acknowledge seeing the transmission, either in the visitors log or the error log. Here is a portion of the debug log:
test gprs uplink to vitalstates server Version:- 1.00
Deactivated
APN set!
Initialised!
Address obtained
Echo Disabled
AT+CIPSTART="TCP","www.vitalstates.org","80"
connected
AT+CIPSEND
GET /wstest/wstestupload.php?one=7771&two=7772&three=7773 HTTP/1.1
AT+CIPCLOSE
logged
AT+CIPSTART="TCP","www.vitalstates.org","80"
connected
AT+CIPSEND
GET /wstest/wstestupload.php?one=7771&two=7772&three=7773 HTTP/1.1
AT+CIPCLOSE
logged
AT+CIPSTART="TCP","www.vitalstates.org","80"
connected
AT+CIPSEND
GET /wstest/wstestupload.php?one=7771&two=7772&three=7773 HTTP/1.1
AT+CIPCLOSE
logged
If anybody has any thoughts I would be extremely grateful
Ed
/*
* ***************************************************************************************
* test the gprs uplink with the test weather station
*
* ***************************************************************************************
*/
#include <SoftwareSerial.h>
#include <avr/wdt.h>
#define DEBUG 1
// #define UPLOAD
#define LOG
#define VER 2.0
#define GPRS_PIN 9
#define LED_PIN 13
#define APN "everywhere\",\"eesecure\",\"secure" // APN for current EE sim card
#define vslserver "www.vitalstates.org"
#define vslwebpage "GET /wstest/wstestupload.php?"
/*
*********************************************************************
* globals
********************************************************************* *
*/
SoftwareSerial GPRS(7, 8); // TX on 7, RX on 8
/*
***********************************
* Function prototypes
***********************************
*/
;
void setup(void);
void loop(void);
void ShowSerialData ();
void upload_packet();
//
// ************************************************************************************
//
void setup()
{
if (DEBUG)
{
Serial.begin(19200);
Serial.print("test gprs uplink to vitalstates server Version:- ");
Serial.println(VER);
}
pinMode(LED_PIN, OUTPUT); // Digital output pin to LED 1
pinMode(GPRS_PIN, OUTPUT); // GPRS initialise pin
init_gprs();
delay(500);
}
//
// **********************************************************************************
//
void loop()
{
upload_packet();
delay(5000);
}
//
// *********************************************************************************
//
void init_gprs()
{
digitalWrite(GPRS_PIN, LOW);
delay(1000);
digitalWrite(GPRS_PIN, HIGH);
delay(2000);
digitalWrite(GPRS_PIN, LOW);
delay(3000);
GPRS.begin(19200);
wdt_enable(WDTO_8S); // Set watchdog timer at 8 seconds
while (!GPRS.find("OK")) // deactivate GPRS PDP context
{
GPRS.println("AT+CIPSHUT");
delay(3000);
}
wdt_disable(); // Disable watchdog timer
{if(DEBUG) Serial.println("Deactivated"); }
// *****************
wdt_enable(WDTO_8S); // Set watchdog timer at 8 seconds
while (!GPRS.find("OK")) // Set the APN
{
GPRS.print("AT+CSTT=\"");
GPRS.print(APN);
GPRS.println("\"");
delay(3000);
}
wdt_disable(); // Disable watchdog timer
{if(DEBUG) Serial.println("APN set!"); }
// *****************
wdt_enable(WDTO_8S); // Set watchdog timer at 8 seconds
while (!GPRS.find("OK")) // Bring up the wireless connection
{
GPRS.println("AT+CIICR");
delay(2000);
}
wdt_disable(); // Disable watchdog timer
{if(DEBUG) Serial.println("Initialised!"); }
// *****************
wdt_enable(WDTO_8S); // Set watchdog timer at 8 seconds
while (!GPRS.find("OK")) // Get local IP address
{
GPRS.println("AT+CIFSR");
delay(2000);
GPRS.println("AT+CIFSR=?");
delay(2000);
}
wdt_disable(); // Disable watchdog timer
{if(DEBUG) Serial.println("Address obtained"); }
// *****************
wdt_enable(WDTO_8S); // Set watchdog timer at 8 seconds
while (!GPRS.find("OK")) // Disable echo prompt
{
GPRS.println("AT+CIPSPRT=0");
delay(2000);
}
wdt_disable(); // Disable watchdog timer
{if(DEBUG) Serial.println("Echo Disabled"); }
}
//
// **********************************************************************************
//
void ShowSerialData ()
{
while(GPRS.available())
{
char c = GPRS.read();
// {if(DEBUG)Serial.print(c); }
}
}
//
// **********************************************************************************
//
void upload_packet()
{
wdt_enable(WDTO_8S); // Set watchdog timer at 8 seconds
GPRS.print("AT+CIPSTART=\"TCP\",\"");
Serial.print("AT+CIPSTART=\"TCP\",\"");
delay(500);
GPRS.print(vslserver);
Serial.print(vslserver);
delay(500);
GPRS.println("\",\"80\"");
Serial.println("\",\"80\"");
while (!GPRS.find("CONNECT OK"))
{
delay(500);
}
wdt_disable(); // Disable watchdog timer
if (DEBUG){Serial.println("connected");}
// Send data to vitalstates log
Serial.println("AT+CIPSEND"); // Start data send
GPRS.println("AT+CIPSEND"); // Start data send
delay(2000);
ShowSerialData();
Serial.print(vslwebpage);
GPRS.print(vslwebpage);
delay(100);
ShowSerialData();
GPRS.print("one=");
Serial.print("one=");
delay(100);
ShowSerialData();
GPRS.print("7771");
Serial.print("7771");
delay(100);
ShowSerialData();
GPRS.print("&two=");
Serial.print("&two=");
delay(100);
ShowSerialData();
GPRS.print("7772");
Serial.print("7772");
delay(100);
ShowSerialData();
GPRS.print("&three=");
Serial.print("&three=");
delay(100);
ShowSerialData();
GPRS.print("7773");
Serial.print("7773");
delay(100);
ShowSerialData();
GPRS.println(" HTTP/1.1\r\n");
Serial.println(" HTTP/1.1\r\n");
delay(100);
ShowSerialData();
GPRS.println((char)26);
delay(2000);
wdt_enable(WDTO_8S); // Set watchdog timer at 8 seconds
while (!GPRS.find("SEND OK"))
{
delay(500);
}
wdt_disable(); // Disable watchdog timer
/*
while(GPRS.available()) // empty GPRS reply buffer
{
Serial.print(GPRS.read());
}
*/
wdt_enable(WDTO_8S); // Set watchdog timer at 8 seconds
GPRS.println("AT+CIPCLOSE");
Serial.println("AT+CIPCLOSE");
while (!GPRS.find("CLOSE OK"))
{
delay(500);
}
wdt_disable(); // Disable watchdog timer
if (DEBUG){Serial.println("logged");}
}