[php] read/write error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux