Home Page"; $contents=str_replace("!!horizlinks!!",$appendstr,$contents); $appendstr="This PHP Link checker is used to determine whether a particular web page contains a link to another web site or page."; $contents=str_replace("!!description!!",$appendstr,$contents); $contents=str_replace("!!title!!",$pagedescription,$contents); $appendstr="link,link checker,php link checker"; $contents=str_replace("!!keywords!!",$pagedescription,$contents); $appendstr=""; $contents=str_replace("!!linkscontent!!",$appendstr,$contents); $appendstr=""; $appendstr.="
\r\n"; function get_contents($address,$page) { global $foundref; $handle = fopen($page, "r"); $found=0; $foundref=0; if ($handle) { $sitecontents=""; while (!feof($handle)) { $sitecontents .= fread($handle, 8192); } fclose($handle); $header= join("\n", $http_response_header); list(,$http_code,$test) = split (" ", $header, 3); if ($http_code=="200") { $sitecontents=strtolower($sitecontents); $address=strtolower($address); $address2=substr($address,7); $hrf="href=\""; $searchstr=$hrf . $address; $qty=substr_count($sitecontents,$searchstr); if ($qty>0) { $found=1; } $hrf="href='"; $searchstr=$hrf . $address; $qty=substr_count($sitecontents,$searchstr); if ($qty>0) { $found=1; } $hrf="href="; $searchstr=$hrf . $address; $qty=substr_count($sitecontents,$searchstr); if ($qty>0) { $found=1; } $searchstr=$address2; $qty=substr_count($sitecontents,$searchstr); if ($qty>0) { $foundref=1; } } //end if found file OK else $found=2; //Indicates HTTP error finding file } //end if handle else $found=2; //Indicates error finding file return $found; } //end of function get_contents if ($checkurl) { global $foundref; $value=get_contents($address,$page); if ($value==1) { $appendstr.="A link to " . $address . " was found on the page " . $page . "."; } else { $appendstr.="A link to " . $address . " was NOT found on the page " . $page . "."; if ($foundref==1) $appendstr.="
A reference to the domain named by " . $address . " was found on the page " . $page . " which indicates a possible reference to the site or a link using JavaScript."; if ($value==2) $appendstr.="
There was an error reading the file."; } } //end of if checkurl $appendstr.="

In the top box, enter the link that you are trying to find on the web page to be tested.
In the lower box, enter the location of the web page that you are testing to determine whether it contains the link.

\r\n"; $appendstr.="
\r\n"; $appendstr.="\r\n"; if ($address) { $appendstr.="\r\n"; } else { $appendstr.="\r\n"; } if ($page) { $appendstr.="\r\n"; } else { $appendstr.="\r\n"; } $appendstr.="\r\n"; $appendstr.="
Link to Search for:
Link to Search for:
At this Webpage URL:
At this Webpage URL:
\r\n"; $appendstr.="
\r\n"; $appendstr.="
\r\n"; $contents=str_replace("!!content!!",$appendstr,$contents); echo $contents; ?>