Return to Snippet

Revision: 1877
at November 17, 2006 13:26 by miziomon


Updated Code
<?php
$host="localhost" ;
$port=12345;
$timeout=30;
$sk=fsockopen($host,$port,$errnum,$errstr,$timeout) ;
if (!is_resource($sk)) {
    exit("connection fail: ".$errnum." ".$errstr) ;
} else {
    fputs($sk, "hello world") ;
    $dati="" ;
    while (!feof($sk)) {
        $dati.= fgets ($sk, 1024);
    }
}
fclose($sk) ;
echo($dati) ;
?>

Revision: 1876
at November 17, 2006 13:08 by miziomon


Initial Code
<?php
$host="localhost" ;
$port=2727;
$timeout=30;
$sk=fsockopen($host,$port,$errnum,$errstr,$timeout) ;
if (!is_resource($sk)) {
    exit("connection fail: ".$errnum." ".$errstr) ;
} else {
    fputs($sk, "hello world") ;
    $dati="" ;
    while (!feof($sk)) {
        $dati.= fgets ($sk, 1024);
    }
}
fclose($sk) ;
echo($dati) ;
?>

Initial URL

                                

Initial Description

                                

Initial Title
Php Socket Client

Initial Tags

                                

Initial Language
PHP