![]() |
|
|||||||
| embarcadero.public.delphiphp.thirdpartytools This group is for all discussion about third-party components for Delphi for PHP. That includes marketing, creating, asking about, and pitching various third-party components. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi,
I am very new to PHP though have delphi programming experience since Delphi 1.0. I have a few client /server applications written in delphi using indy client & server components. We are looking at providing web interfaces to some of these server apps and thought that Delphi PHP would be the way to go. To get started though we need to be able to connect to our server app using a TCP?ip connection. Can anyone recommend a socket component that could do this for us, ideally with some demos as our knowledge is about nil. Thanks |
| Sponsored Links |
|
|
|
|||
|
Glen Welch wrote:
> Hi, > I am very new to PHP though have delphi programming experience since > Delphi > 1.0. I have a few client /server applications written in delphi using > indy > client & server components. > We are looking at providing web interfaces to some of these server apps > and > thought that Delphi PHP would be the way to go. > To get started though we need to be able to connect to our server app > using > a TCP?ip connection. Can anyone recommend a socket component that could > do > this for us, ideally with some demos as our knowledge is about nil. PHP already has easy to use TCP/IP connection abilities. For example: // Open a connection to www.example.com on port 80. $fp = fsockopen("www.example.com", 80, $errno, $errstr, 30); if( !$fp ) { // If connection fails, throw Exception. throw new Exception( "Failed to connect to www.example.com, $errstr ($errno)" ); } else { // Create a HTTP GET request $out = "GET / HTTP/1.1\r\n"; $out .= "Host: www.example.com\r\n"; $out .= "Connection: Close\r\n\r\n"; // Send it to the socket. fwrite($fp, $out); // While there is data to be read, and the connection is open, keep reading. while( !feof( $fp ) ) { echo fgets($fp, 128); } // Close the connection handle. fclose( $fp ); } Jon |