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" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to