Re: eregi not working
| From: | Jason Wong | Date: | Sat, 08 Jun 2002 05:40:09 +0000 |
| Subject: | Re: eregi not working | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-101242@lists.php.net to get a copy of this message | ||
On Saturday 08 June 2002 10:48, Robert Packer wrote:
> Can someone tell me why this isn't working? To me it say open the file,
> read it, stick into a variable, close the file. Then search that variable
> (the file) and look for the eregi statements. Can someone tell me why this
> only gets the first instance of what I'm searching for? Thanks a bunch.
>
> #!/usr/bin/php -q
> <?
> $site = "proxy.html";
> $open = fopen($site, "r");
> $contents= fread($open,filesize($site));
> fclose($open);
> $search=eregi("[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}",
> $contents,$array);
> echo $array[0];
> echo $array[1];
> echo $array[2];
> ?>
It looks like you're trying to match IP addresses? In which case shouldn't you
have "echo $array[3];" as well?
Anyway that's besides the point, what is the format of your file?
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
I've got a bad feeling about this.
*/