[PHP] eregi not working

2002-06-07 Thread Robert Packer

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];
?





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




Re: [PHP] eregi not working

2002-06-07 Thread Jason Wong

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




[PHP] eregi not working???

2001-03-20 Thread Clayton Dukes




I have a script that looks for title tags, 
but it doesn't seem to be picking up the titles, can anyone tell me 
why?


Almost all of theweb pages look like: 
?if(!isset($mainfile)) { include("mainfile.php"); 
}if(!isset($headers_sent)) { include("header.php"); 
}?!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 
3.2//EN"HTMLHEAD 
TITLESome Title/TITLE META 
NAME="Author" CONTENT="Some Name" 
/HEADBODYHere's my 
function:

function 
getTitle($doc){ 
if (eregi("title(.*)/title", $doc, 
$titlematch)) 
$title = trim(eregi_replace("[[:space:]]+", " " , 
$titlematch[1])); 
else 
$title = ""; if ($title == 
"") 
$title = "Untitled 
Document"; return 
$title;}itruns okay...But, when I use 
the function, everything is coming back as "Untitled Document". 
Any suggestions? Clayton 
Dukes-Download 
Free Essays, Term Papers and Cisco Training from http://www.gdd.net

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]