Reply to Re: is this avail somewhere

Your name:

Reply:


Posted by Steve on 10/18/06 14:50

"Kentor" <kentor@gmail.com> wrote in message
news:1161182321.585469.95080@b28g2000cwb.googlegroups.com...
| Hello, is there a script that would go to a page that i would indicate
| and look for a specific links... to sort of make sure that reciprocal
| links are there when promised by other websites...

kentor,

this is typically called screen-scraping. generally, one is simply looking
for all links. here is a quick example of that. the only change you'd need
to make (assuming you're using php 5) is to look for your specific link in
the results (which is in the loop). this source is from:

http://blog.outer-court.com/archive/2004_06_23_index.html

<?
header("Content-type: text/html; charset=utf-8");

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
<html xmlns=http://www.w3.org/1999/xhtml xml:lang="en" lang="en">
<head>
<title>PHP5 Screen-Scraping</title>
</head>
<body>

<?

$dom = new domdocument;

$url = 'http://news.google.com';

@$dom->loadHTMLFile($url);

$xpath = new domxpath($dom);
$xNodes = $xpath->query('//a[@class="y"]');
echo '<h1>Google News Headlines</h1>';
echo '<ul>';
foreach ($xNodes as $xNode)
{
$sLinktext = @$xNode->firstChild->data;
$sLinkurl = $xNode->getAttribute('href');

if ($sLinktext != '' && $sLinkurl != '')
{
echo '<li><a href="' . $sLinkurl . '">' .
$sLinktext . '</a></li>';
echo "\r\n";
}
}
echo '</ul>';
?>

</body>
</html>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация