Jump to content

finding a link within a webpage?


merylvingien

Recommended Posts

Hi fellers, i posted a question some time ago, but never got round to following it up as i was busy with other things.

 

I take it that php can search a page and see if a link is contained within the said page?

 

I have this basic code

 

<?php

$homepage = file_get_contents('http://www.somesite.com/');
$link = 'www.mysite.com'


$pos = strpos($homepage, $link);
if ($pos === false) {
    echo "The string '$link' was not found in the page";
} else {
    echo "The string '$link' was found in the page";
}

?>

 

I am getting an error with $pos = strpos($homepage, $link); line: unexpected T_VARIABLE

 

Any thoughts would be appreciated  ;)

Link to comment
https://forums.phpfreaks.com/topic/187497-finding-a-link-within-a-webpage/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.