[php] read/write error

From: Date: Mon, 08 Jun 2009 16:33:07 +0000
Subject: [php] read/write error
Groups: php.general 
Request: Send a blank email to php-general+get-293743@lists.php.net to get a copy of this message
opening of the sorket is ok and writting LOGIN packet to the sorket is also ok but reading the response to know if the login is accepted or rejected is a not OK. please help $port ="xx"; $ip ="xx.xx.xxx"; $timeout = 30; $start ="L"; $Login = "user "; $Password ="pass "; $session = " "; $Sequence = " 1"; // $Terminator ="A"; $LRG = "$start$Login$Password$session$Sequence$Terminator"; $fsock = fsockopen($ip,$port, $errno, $errstr, $timeout); // *OK * if (!$fsock) { echo "$errstr ($errno)"; //"$errstr ($errno)<br />\n"; } else { $bits = fwrite($fsock,$LRG); echo "bits: $bits<br>"; //*OK * //read responds $contents = fread( $fsock, filesize($fsock)); //*ERROR * //echo stream_get_contents($fsock); echo filesize($contents); if($contents===FALSE) { echo "*THERE WAS AN ERROR READING*\n"; } else{ while ( ($buf=fread( $contents, 8192 )) != '' ) { $contents .= $buf; echo $contents."<br>"; } } fclose($fsock); } -- www.bemycandy.com

« previous php.general (#293743) next »