Crawler
Posted: Sat Oct 25, 2008 9:38 pm
Hi,
I am trying to index a website. I am struck. Can someone help me out getting this right? i am not getting all the links.
Thanks
I am trying to index a website. I am struck. Can someone help me out getting this right?
Code: Select all
$ulr = 'http://localhost/my_search/';
$first_page_links = Links($ulr);
foreach($first_page_links as $first_page_link)
{
$all_links[] = Links($first_page_link)
return $all_links;
}
Code: Select all
function Links($url)
{
$fc = file_get_contents($url);
preg_match_all('/\s+href\s*=\s*[\"\']?([^\s\"\']+)[\"\'\s]+/ims', $fc, $links);
return $links[1];
}