php-general | 2001092
Date: 09/17/01
- Next message: Jeff Lewis: "[PHP] Can someone help me parse XML? - Challenge"
- Previous message: Andrew Perevodchik: "[PHP] imap"
- In reply to: chinmay varma: "[PHP] EXTRACTING URL FROM A FILE"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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>
- Next message: Jeff Lewis: "[PHP] Can someone help me parse XML? - Challenge"
- Previous message: Andrew Perevodchik: "[PHP] imap"
- In reply to: chinmay varma: "[PHP] EXTRACTING URL FROM A FILE"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

