PHP Post code

Discussion of the online video show SuperHouseTV, where Freetronics co-founder Jonathan Oxer hacks on his house using various Open Source hardware and software. [SuperHouseTV site]
Post Reply
FasterThanX
Posts: 1
Joined: Sun Jan 12, 2014 1:02 pm

PHP Post code

Post by FasterThanX » Sun Jan 12, 2014 1:07 pm

Hi there.

I have seen all of the episodes and I am amazed by your system.
Great work!
In a video http://www.youtube.com/watch?v=ZUEKr_48 ... dded#t=532 you talked about PHP post.
Could you post the code please that is sent from yous switch to Apache and from Apache to a relay board.

Best regards

aitken85
Posts: 2
Joined: Sat Nov 08, 2014 1:52 am

Re: PHP Post code

Post by aitken85 » Sat Nov 08, 2014 3:11 am

I use PHP for living, so maybe I could write some mock code to answer your post.

Sending information to your apache php script:

Code: Select all

http://my_address/my_script.php?var1=50&var2=20&var3=1
Within my_script.php to retrieve the incoming values:

Code: Select all

echo $_GET['var1']; // equals 50.
echo $_GET['var2']; // equals 20.
echo $_GET['var3']; // equals 1.
Sending to your apache script from a HTML form:

Code: Select all

<form method="post" action="http://my_address/my_script.php">
<input name="var1" type="text">
<input name="var2" type="text">
<input type="submit">
</form>
Within my_script.php to retrieve the incoming form values:

Code: Select all

echo $_POST['var1'];
echo $_POST['var2'];

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest