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:
<!DOCTYPE html>
<html>
<head>
<script>
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;
}
</script>
</head>
<body>
Field2: <input type="text" id="field2" />
<input type='button' id="but1" onclick='on()' value='ON' />
<input type='button' id="but2" onclick='off()' value='OFF' />
<?php
echo "hashar";
if (state == "ON")
{
echo "on!";
}
if (state == "OFF")
{
echo "off!";
}
?>
</body>
</html>
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
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:
var namevalue=encodeURIComponent(document.getElementById("but2").value)
mygetrequest.open("GET", "myform.php?name="+namevalue, true)
mygetrequest.send(null)
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:
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:
AT+HTTPREAD=<data_len>, , 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?