system
February 21, 2011, 1:21pm
1
Hi there
Would it be possible to obtain an integer $variable from an http://..../file.php, say "5" and store in the Arduino code as the $variable?
Using the HTTP GET protocol, whenever required?
How would this be possible? I have so far been using things like substring & XML from old forum posts - yet are quite cumbersome - so is there a simpler, newer approach?
thanks
Calum
system
February 21, 2011, 2:05pm
2
Would it be possible to obtain an integer $variable from an http://..../file.php, say "5" and store in the Arduino code as the $variable?
You can get the value, if the script outputs the value.
so is there a simpler, newer approach?
No.
system
February 21, 2011, 2:07pm
3
in what way is it possible to obtain the value?
system
February 21, 2011, 2:49pm
4
In your php script, say "echo $variable."
In your sketch, create a client object and call client.read().
It's not very graceful but it is possible.
system
February 21, 2011, 2:52pm
5
in what way is it possible to obtain the value?
Telepathy, osmosis, divination,...
What does the php script do? It should generate some kind of output. That output is what is received as a result of the GET command.
If the php script contains
$i = 3;
and the output that it produces is:
You lose
I am not going to tell you about $i
then there is no way to get the value.
If, on the other hand, the output is
$i = 3
then it isn't rocket science to extract the value from the stream.