PHP Curl to grab all the links from a webpage

Associate
Joined
27 Jun 2006
Posts
1,473
Guys.

Trying to figure a script out to go to a website and grab all URLs on the page with a certain word.

Now I can do the CURL bit for visiting the site but haven't a barry blue how to set about getting the URLs out with the word.

I am guessing that I would have to look at regular expressions, but any pointers / advice appreciated :)

Code so far (sort of Googled and copy / paste job):
PHP:
$ch = curl_init();
	curl_setopt($ch, CURLOPT_USERAGENT, $agent);
	curl_setopt($ch, CURLOPT_REFERER, $referer);
    curl_setopt($ch, CURLOPT_URL, $website);
    $html = curl_exec($ch);
    curl_close($ch);

Any advice how to get the URLs that contain a certain word appreciated!

Cheers
M.
 
Back
Top Bottom