Arduino Due + Gsm Shield upload data to website

I am using the Due in compination with the arduino Gsm shield and i am trying to send a GET or POST to a webpage.

This is my code,

//#include <SoftwareSerial.h>
//SoftwareSerial gprsSerial(7, 8);

void setup()
{
  Serial.begin(19200);



  delay(2000);

  Serial.flush();


  // attach or detach from GPRS service 
  Serial.println("AT+CGATT?");
  delay(100);
  toSerial();


  // bearer settings
  Serial.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");
  delay(2000);
  toSerial();

  // bearer settings
  Serial.println("AT+SAPBR=3,1,\"APN\",\"internet\"");
  delay(2000);
  toSerial();

  // bearer settings
  Serial.println("AT+SAPBR=1,1");
  delay(2000);
  toSerial();
}


void loop()
{
   // initialize http service
   Serial.println("AT+HTTPINIT");
   delay(2000); 
   toSerial();

   // set http param value
   Serial.println("AT+HTTPPARA=\"URL\",\"http://uopuav.co.nf/404.html/?data=150005959\"");
   delay(9000);
   toSerial();

   // set http action type 0 = GET, 1 = POST, 2 = HEAD
   Serial.println("AT+HTTPACTION=0");
   delay(6000);
   toSerial();

   // read server response
   Serial.println("AT+HTTPREAD"); 

   delay(1000);
   toSerial();

   Serial.println("");
   Serial.println("AT+HTTPTERM");
   toSerial();
   delay(300);

   Serial.println("");
   delay(10000);
}

void toSerial()
{
  while(Serial.available()!=0)
  {
    Serial1.write(Serial.read());
  }
}

and this is the form on the website

<form action="action_page.php" method="get">

  data:

  <input type="text" name="data">

</form>

and the php that runs with the form action.

<?php
if(intval($_GET['data']) != 0)
{

        $data = intval($_GET['data']);
        $fp = fopen('info.txt','w');

        fwrite($fp,serialize($data)); 
}




    

$infotxt = file_get_contents('info.txt');
$info = unserialize($infotxt); 
print $info;
?>

the code compiles with no errors, when i use the form on the website from my computer i can store the values just fine but when i am trying to access it from the Due nothing happens.
Anyone has an idea of what i'm doing wrong here?

Thank you for your time!

and the php that runs with the form action.

Where is located this php code? I mean, in your PC or Arduino Due?
How the php code is executed?

giova014:
Where is located this php code? I mean, in your PC or Arduino Due?
How the php code is executed?

the php is located on the web server, it runs when the form is submitted, it just stores the data from the form to a file on the server and prints the file contents to the screen

You send your form to your WebServer (which is not the Arduino Due), and them the WebServer return an update to the WebPage.

So when the info about the form is sent to Arduino Due?

Does the WebServer receive, process and respond to the Arduino Due request? Because the WebPage can't respond to Requests.

giova014:
You send your form to your WebServer (which is not the Arduino Due), and them the WebServer return an update to the WebPage.

So when the info about the form is sent to Arduino Due?

Does the WebServer receive, process and respond to the Arduino Due request? Because the WebPage can't respond to Requests.

The webserver does not communicate with the Due, what i am trying to do is have the Due send data to the server. Just that.

So for example the due will visit the webpage myserver.com/?data=5 and the server will store the value of data that is "5".

Thank you for your responses.

Edit: Added explanation

In your code, there is the Request Path string:

http://uopuav.co.nf/404.html/?data=150005959

The WebServer will process the "data" at "404.html/" (The '/' is wrong, it must be removed)

Try changing it to:

http://uopuav.co.nf/action_page.php?data=150005959

So the WebServer will process the "data" at "action_page.php"

giova014:
Edit: Added explanation

In your code, there is the Request Path string:

http://uopuav.co.nf/404.html/?data=150005959

The WebServer will process the "data" at "404.html/" (The '/' is wrong, it must be removed)

Try changing it to:

http://uopuav.co.nf/action_page.php?data=150005959

So the WebServer will process the "data" at "action_page.php"

Didn't work. The value did not change on the server.
How could i check if the modem actually reaches the internet?

If you type direct into your Web Browser (like Chrome) this link:

http://uopuav.co.nf/action_page.php?data=150005959

(Check if) the value will change in your Web Server?

giova014:
If you type direct into your Web Browser (like Chrome) this link:

http://uopuav.co.nf/action_page.php?data=150005959

(Check if) the value will change in your Web Server?

yes it does

So there is an error with your Http Setup or Http Request sequence code.

Check the AT Command Manual of the shield and analyse every Command you are using and what are the expected parameters.

As I don't have this shield, I can't help you any further.

Of course, googling it is a very good start.

I'm leaving with a quick reference link that I found:

SIM900 GPRS/GSM Shield

giova014:
So there is an error with your Http Setup or Http Request sequence code.

Check the AT Command Manual of the shield and analyse every Command you are using and what are the expected parameters.

As I don't have this shield, I can't help you any further.

Of course, googling it is a very good start.

I'm leaving with a quick reference link that I found:

SIM900 GPRS/GSM Shield

Ok, i will do that, thank you for your help!