Response to fsockopen

154 views Asked by At

Hi I'm trying to write a client-server function. I've written part of the code from the client side asking the server to login, I now need some simple code to start me off that I could use as a response from the server.

Client code:

<?php
$fp = fsockopen("XXXX.XXXXX.com", 1980, $errno, $errstr, 30);
if (!$fp) {
  echo "$errstr ($errno)<br />\n";
 } else {
    $out = "<UserStatus timestamp='0' type='login' UserID='####' key='XXXX' /> \r\n";

    fwrite($fp, $out);
    while (!feof($fp)) {
        echo fgets($fp, 128);
    }
    fclose($fp);
}

?>

Please can some give me an example of some code.

0

There are 0 answers