merylvingien Posted January 6, 2010 Share Posted January 6, 2010 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 More sharing options...
simshaun Posted January 6, 2010 Share Posted January 6, 2010 You are missing a semicolon to end $link = 'www.mysite.com' Link to comment https://forums.phpfreaks.com/topic/187497-finding-a-link-within-a-webpage/#findComment-990004 Share on other sites More sharing options...
merylvingien Posted January 6, 2010 Author Share Posted January 6, 2010 Doh! Cheers Link to comment https://forums.phpfreaks.com/topic/187497-finding-a-link-within-a-webpage/#findComment-990005 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.