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?

    Matthew Moldvan

 System Administrator
 Trilogy International, Inc

-----Original Message-----
From: Dave Carrera [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 11, 2003 1:32 PM
Subject: [PHP-DB] 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);
$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 (
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to