RE: fgets find string help please

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

 



Correct me if I'm wrong, but something like:

if(($string=fgets($socket,128)) == "hello")
	echo 'success!';

should work.  In C or C++ you would use strcmp, but luckily PHP doesn't have
that drawback.

Out of curiosity, what are you working on?

Regards,
    Matthew Moldvan

---------------------------------------
 System Administrator
 Trilogy International, Inc
  http://www.trilogyintl.com/ecommerce/
--------------------------------------- 

-----Original Message-----
From: Dave Carrera [mailto:dave@davecarrera.com]
Sent: Tuesday, February 11, 2003 1:32 PM
To: php-db@lists.php.net
Subject:  fgets find string help please


Hi all
 
I would like to find a string say “hello” from the result of my
fsockopen result.
 
I have searched all over for an answer but to no avail so I hand it over
to you clever people here.
 
The kind of result I want is if string excists the $result = 0 else
$result = 1
 
I can carry on from there….
 
while(!feof($socket)) {
       echo fgets($socket,128);
      }
      fclose($socket);
 
$socket is working and echoing a result.
 
Any help is very much appreciated
 
Dave Carrera

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux