Jump to content

Recommended Posts

I'm interested in trying to use PHP through a browser and webserver in a domestic house to get information from networked sensors (a thermometer for example) and to turn networked switches on and off.

I can't see anything on the net yet, so I thought I would ask in a forum of experts on PHP!  :D

 

I thought that the control functions (WHILE, IF, DO WHILE, FOREACH &c) and logic functions (OR, AND, XOR &c) would allow me to write a script which could collect or send data to say a switch when certain criteria are met &c.  Presumably a database on the webserver could store status information about a switch or sensor which could be used as part of the control. 

I don't know if this is far-fetched or not.  Any thoughts?  ???

php isn't really designed to interact with things on the hardware level.  You would need a lower level language for that, like c++ for example.  If you are using windows, you can possibly look into com to interact with some other program.

Actually I did something similar in the past,  but the sensor data was written on the filesystem by the sensor itself .

I used a perl daemon  to parse it and to send it to a mysql db . Then the data was extracted from the db via PHP and showed as a web page by an Apache web server ...

I think you will still need c or c++ to communicate with the sensor. You could write a desktop app that receives signals from the sensor and stores it to a mysql (or any db).

 

then as second application you build a php driven website that reads the same database as the c++ application

Actually I did something similar in the past,  but the sensor data was written on the filesystem by the sensor itself .

I used a perl daemon  to parse it and to send it to a mysql db . Then the data was extracted from the db via PHP and showed as a web page by an Apache web server ...

 

well yeah...but that's the point.  Some other program is interacting with the sensor, writing the data to a file.  PHP can parse data in a file and display it or put it into a db just fine.  The point though is that it's not designed to directly interact with hardware.

I mean, if you really really really wanted to do strictly php, you could write and compile your own php extension.  But that is done through c...which if you're gonna go that far, you may as well just write it in c in the first place.

She's just raising your self-esteem because that's what good mothers (and friends of mothers) do.  That doesn't mean you're really sexy.  It's a win-win situation, nonetheless.  Even if you're butt ugly, chicks dig confidence. 

well i make extra money by doing exotic dancing for their parties sometimes.  i know it's a little bit degrading, but hell we all know that coding doesn't pay the bills anymore...with the economy crashing and all the smart poor people out there in the 3rd world willing to code  just for rice and stringbeans.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.