Go Down

Topic: POSTing from site to SIM900 module (Read 1 time) previous topic - next topic


Oct 02, 2012, 09:37 pm Last Edit: Oct 02, 2012, 09:40 pm by NI$HANT Reason: 1
Well I have successfully used the GPRS to uplift whatever I like and store it on my websites database whenever however I may like , but now I'm trying to mod the stuff and write some script etc to make the arduino receive stuff from my website , like say a button clicked  , whenever I put php along with the scripting the php does not work, the code is as follows:

Code: [Select]
<!DOCTYPE html>
var state
function on()
 state = document.getElementById('but1').value;
 document.getElementById('field2').value = state;
function off()

 state = document.getElementById('but2').value;
 document.getElementById('field2').value = state;

Field2: <input type="text" id="field2" />
<br /><br />
<input type='button' id="but1" onclick='on()' value='ON' />
<input type='button' id="but2" onclick='off()' value='OFF' />
echo "hashar";
             if (
state == "ON")
             if (
state == "OFF")


on the FIELD2: box shows and the two respective button also the scripting works but then nothing shows out of the php code.

Another point here is how I access the variables in scripting? I want to access the state variable
"Real Men can Accomplish  Anything"

- skype : nishants5  

ਫ਼ਤੇਹ ਕਰੁਂ!


This is a PHP problem and has nothing to do with the Arduino! Ask in a PHP forum.

Hint anyway: PHP has no direct access to javascript variables, think about when and where PHP is executed, when and where javascript is executed.


Oct 05, 2012, 08:50 pm Last Edit: Oct 05, 2012, 09:09 pm by NI$HANT Reason: 1
Actually Now I have made some progress, I have used AJAX request to shoot HTTP get requests and that code is working flawlessly:

An excerpt from the code showing HOW the get data is sent to the script myform.php in a Silent way that is not opening any windows or showing in the link the script file running:

Code: [Select]
var namevalue=encodeURIComponent(document.getElementById("but2").value)
mygetrequest.open("GET", "myform.php?name="+namevalue, true)

At the other side the myform.php receives the values correctly you can see at http://winacro.com/scriptGET.php

So now I want to send the clicks to my SIM900 module running using ATmega328, previously I did the following request code and was successful in loading the values to a database on my server BUT THE MAIN QUESTION HERE IS HOW I CAN DO IT IN THE OTHER WAY AROUND that is now to send values from my site to Arduino:

Code: [Select]
reading = analogRead(tempPin);
 tempC = reading / 9.31;


 mySerial.println("AT+HTTPACTION=1");//submit the request

I wanted to know I should I make the AT+HTTPPARA loaded as such I get the values from the clicks I make on that page.

EDIT: I further read into the SIM900 datasheet and what I read about is two commands that may work for me as follows:

1) AT+HTTPREAD=<data_len>,<byte size> , to be used when the  AT+HTTPACTION=0 or AT+HTTPDATA is executed , so where should I execute it above httpaction and httpdata or below, I mean simply where should I write it?


2) AT+HTTPDATA=<size>,<time>,where in the code?
"Real Men can Accomplish  Anything"

- skype : nishants5  

ਫ਼ਤੇਹ ਕਰੁਂ!



Did you ever figure out how to get the data into your GSM module?

Go Up