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. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php