russell_newton Posted January 24, 2009 Share Posted January 24, 2009 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! 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? ??? Quote Link to comment https://forums.phpfreaks.com/topic/142253-solved-php-to-interact-with-networked-sensors/ Share on other sites More sharing options...
.josh Posted January 24, 2009 Share Posted January 24, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/142253-solved-php-to-interact-with-networked-sensors/#findComment-745255 Share on other sites More sharing options...
enkidu72 Posted January 24, 2009 Share Posted January 24, 2009 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 ... Quote Link to comment https://forums.phpfreaks.com/topic/142253-solved-php-to-interact-with-networked-sensors/#findComment-745277 Share on other sites More sharing options...
RichardRotterdam Posted January 24, 2009 Share Posted January 24, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/142253-solved-php-to-interact-with-networked-sensors/#findComment-745281 Share on other sites More sharing options...
.josh Posted January 24, 2009 Share Posted January 24, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/142253-solved-php-to-interact-with-networked-sensors/#findComment-745284 Share on other sites More sharing options...
.josh Posted January 24, 2009 Share Posted January 24, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/142253-solved-php-to-interact-with-networked-sensors/#findComment-745287 Share on other sites More sharing options...
enkidu72 Posted January 24, 2009 Share Posted January 24, 2009 The linux kernel module fuse was doing that ... So maybe If he's using a linux box can avoid that part . Quote Link to comment https://forums.phpfreaks.com/topic/142253-solved-php-to-interact-with-networked-sensors/#findComment-745289 Share on other sites More sharing options...
rubing Posted January 24, 2009 Share Posted January 24, 2009 this was kind of like my idea to connect an infra-red or temperature sensor to my computer, so i could analyze whether my blind dates were getting hot for me and ready to shag. Quote Link to comment https://forums.phpfreaks.com/topic/142253-solved-php-to-interact-with-networked-sensors/#findComment-745306 Share on other sites More sharing options...
.josh Posted January 24, 2009 Share Posted January 24, 2009 alternatively, their temperature could be rising due to them getting angry at you, or getting nervous because you are coming off as creepy. Quote Link to comment https://forums.phpfreaks.com/topic/142253-solved-php-to-interact-with-networked-sensors/#findComment-745308 Share on other sites More sharing options...
rubing Posted January 24, 2009 Share Posted January 24, 2009 i don't think so my mom and her friends always tell me i'm a sexy guy. Quote Link to comment https://forums.phpfreaks.com/topic/142253-solved-php-to-interact-with-networked-sensors/#findComment-745396 Share on other sites More sharing options...
.josh Posted January 24, 2009 Share Posted January 24, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/142253-solved-php-to-interact-with-networked-sensors/#findComment-745400 Share on other sites More sharing options...
rubing Posted January 24, 2009 Share Posted January 24, 2009 They also like the fact that i'm hung like ron jeremy...Oh yeah baby! Quote Link to comment https://forums.phpfreaks.com/topic/142253-solved-php-to-interact-with-networked-sensors/#findComment-745449 Share on other sites More sharing options...
.josh Posted January 24, 2009 Share Posted January 24, 2009 The fact that your mom and her friends talk about you being 'hung' doesn't bother you? Or openly telling people in public this, doesn't bother you? Oh boy, I think we have our next episode of Jerry Springer. Quote Link to comment https://forums.phpfreaks.com/topic/142253-solved-php-to-interact-with-networked-sensors/#findComment-745463 Share on other sites More sharing options...
rubing Posted January 24, 2009 Share Posted January 24, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/142253-solved-php-to-interact-with-networked-sensors/#findComment-745481 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.