Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2001092

[PHP] Re: EXTRACTING URL FROM A FILE From: _lallous (elias_bachaalany <email protected>)
Date: 09/17/01

your regexp won't work...you have to change it! cause a quick look to
yahoo's index page:

<a href=r/f3>Photos</a> - <a href=r/dr><b>Domain Registration</b></a> -
see?!

I made this regexp which is partially working:

$re = "/<a href=(['\"]*|)(.+?)(\1|[ ])[^>]*>(.+?)<\/a>/is";

"Chinmay Varma" <chinmayvarma <email protected>> wrote in message
news:20010917101835.13911.qmail <email protected>
Hi all,
The following is a sample code I try to extract URL from a Web Page.Its not
finding any match.Any idia why ?
Kindly let me know.
Thanks to all.
chinmay.
***********************************************************
$fp = fopen('http://yahoo.com/','r') or die ("Cannot connect");
while($line = fgets($fp,1024))
{

if(preg_match_all('/<.*?a.*?href=\s*?[\'"](.+)[\'"].*?>.*?<\/.*?a.*?>/i',$li
ne,$matches))
  {
    array_shift($matches);
    foreach($matches as $match)
    {
$url_list = $match;
echo $match;
    }
  }
}
********************************************************

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>