Can PHP running on a Linux webserver open, via the internet, a remote laptop's serial port and issue instructions?

I'd like to have a web page (internet surfer) invoke PHP code from a website and open a remote, standard, internet connect laptop's serial port. Can PHP do that? what PHP statements should I start with? Any examples anyone would like to send my way?

kc

    http://www.phpclasses.org/browse/package/3679.html

    Google rules. Depending on your setup, this should work for you (if the server is opening the serial port on itself - if you're trying to open the serial port on any visiting machine, this isn't the right way to do it, since PHP runs on the server and can't really access local user files/ports.)

      Basically, if there were any way for a web server to open a serial port on a client PC accessing it via its web browser, that would be a huge, gaping security hole. You would need some sort of client-side application to run on the PC that would access the serial port and also communicate with the web server program.

        Well, I guess what I trying to do is on the line of these internet connected devices. Go to a website and click and turn on a light in a house, etc. From what I've seen so far it seems that the webpage sits on same server with the serial port, or the service is provide via 3rd party software...Or the site is slightly vague about how the connection is done...or it's not in PHP.

        I agree this could be a security hole if the Laptop owner was unaware. But we'd be working on a model where the laptop is a partner or peer in the project.

        maybe somewhat like www.drivemeinsane.com.

          Horizon88 wrote:

          http://www.phpclasses.org/browse/package/3679.html

          Google rules. Depending on your setup, this should work for you (if the server is opening the serial port on itself - if you're trying to open the serial port on any visiting machine, this isn't the right way to do it, since PHP runs on the server and can't really access local user files/ports.)

          Thanks.... I've use code from phpclasses before. Great group. And I had ran across that code too.

          But the serial port will be remote. So the challenge is to have an webserver internet event translated (I'm open to solution ideas) to action on a serial port on a local, non-associated, internet connect laptop (or desktop) PC.

            You could install PHP on the laptop with that serial class, and have the website they visit use curl or sockets to the server on the laptop to trigger the serial class.

            You'd go Client Laptop -> Webserver -> Client Laptop

            Client laptop would send the request to the webserver, the webserver would then send it's OWN request to the CLIENT laptop's server using something like curl or a socket connection. The client laptop would have code snippet that would catch the incoming request, then run the serial class code on its own. PHP may not be the best language for this, but if you figure it out, please let me know. 🙂

              Horizon88 wrote:

              You could install PHP on the laptop with that serial class, and have the website they visit use curl or sockets to the server on the laptop to trigger the serial class.

              You'd go Client Laptop -> Webserver -> Client Laptop

              Client laptop would send the request to the webserver, the webserver would then send it's OWN request to the CLIENT laptop's server using something like curl or a socket connection. The client laptop would have code snippet that would catch the incoming request, then run the serial class code on its own. PHP may not be the best language for this, but if you figure it out, please let me know. 🙂

              My brain hurts :-) So how about PHP code, on the laptop, that just scrapes a webserver file. Can PHP at the laptop reach out over the internet and read a simple text file and a regular interval?

                Yep. You could set up a scheduled task in windows or a cron job in linux that would execute a PHP script on the laptop to pull down a text file, parse it a certain way, and run it at the specified intervals. Then you could run the socket connection code on the laptop that way, I suppose.

                  Write a Reply...