Monthly Archives: July 2005

PHP to TCP Socket Form

This assumes the remote device accepts the socket connection on the port you choose to connect to.Thanks to John Schimmel for writing the code.<?php/*by John Schimmel, john.schimmel@gmail.comMay 9, 2005This script will display a html form. On submit, the form will call itself and then check to see if the form element ‘text1′ is set. If set a socket is made to the define IP address and port and the value of ‘text1′ is sent down the pipe.The socket then disconnects and the form is redisplayed with the value of ‘text1′ in the html form’s textbox.IMPORTANT: If you are using an XPORT or COBOX change the connect mode to C4so no IP address is being concatenating with the incoming message to the pic….unless you like it that way.*/$xportIP = “128.122.151.44″; //IP adddress to connect to$port = 10001; // port number of IPif ((isset($_POST["text1"])) && (isset($_POST["ip"])) && (isset($_POST["port"]))) { //if a filled textbox was submitted $data = $_POST["text1"]; $ip = $_POST["ip"]; $port = $_POST["port"]; $fp = fsockopen ($ip, $port, $errno, $errstr, 30); //open the socket if (!$fp) { //if the socket does not exist echo “$errstr ($errno)\n”; } else { //if the socket exists fputs ($fp, $data); // send the data down the hole to the other end echo “<font size=’2′ color=’navy’>Message Sent: ” .
Continue reading

Posted in PHP | Comments Off

TCP Socket Server in PHP

Run it locally on your own machine; don’t try it on a production server first. It has an endless loop that will keep it going until you kill the process.Thanks to John Schimmel for writing it. Continue reading

Posted in PHP | Comments Off

Powerfilm

POwerfilm is a thin, rollable solar cell.
Continue reading

Posted in circuits | Comments Off