viper799
02-21-2005, 08:30 PM
Hello I need a little help with a php script that I am working on to grab links of a web page then check for my link and display my link and anchor text
here is what I have
<?php
// URL1
$url="http://dreamworx.cz/";
// URL2
//$url="http://www.righthanddrivejeeps.us/temp.html";
$domain="www.righthanddrivejeeps.us";
$remote = fopen($url, 'r');
$html = fread($remote, 10342400);
fclose($remote);
preg_match_all("|<[^>]+>(.*)</[^>]+>|U",
$html,
$out, PREG_SET_ORDER);
for ($i=0; $i< count($out); $i++)
{
if (preg_match("/\b$domain\b/i", $out[$i][0])) {
// display if one of the links is my link, full code & anchor text
echo $out[$i][0] . ", " . $out[$i][1] . "<br>";
}
}
?>
I can get url2 to work but not url1 they both have links to the $domain
please I could use some help here I plan to add on to update my link dir DB with the anchor text of the link parnter so I can have an count on the links with the same anchor text.
thanks
here is what I have
<?php
// URL1
$url="http://dreamworx.cz/";
// URL2
//$url="http://www.righthanddrivejeeps.us/temp.html";
$domain="www.righthanddrivejeeps.us";
$remote = fopen($url, 'r');
$html = fread($remote, 10342400);
fclose($remote);
preg_match_all("|<[^>]+>(.*)</[^>]+>|U",
$html,
$out, PREG_SET_ORDER);
for ($i=0; $i< count($out); $i++)
{
if (preg_match("/\b$domain\b/i", $out[$i][0])) {
// display if one of the links is my link, full code & anchor text
echo $out[$i][0] . ", " . $out[$i][1] . "<br>";
}
}
?>
I can get url2 to work but not url1 they both have links to the $domain
please I could use some help here I plan to add on to update my link dir DB with the anchor text of the link parnter so I can have an count on the links with the same anchor text.
thanks