RE: [PHP-DB] fgets find string help please
| From: | Matthew Moldvan | Date: | Tue, 11 Feb 2003 19:02:06 +0000 |
| Subject: | RE: [PHP-DB] fgets find string help please | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-25571@lists.php.net to get a copy of this message | ||
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: [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);
}
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