0

I build a free widget for my customers but I want them to put my website link on their websites so I want to check regularly their websites html code for my site link and if they remove the link I will stop the widget automatically. I want to know am I thinking correctly? I mean, is it possible to check websites' code remotely? then if it is possible how to start? I thought about getting the html of the page using php method file_get_content and then parse the returned file but I could not because I did not find a way to parse the returned string.

$html = htmlentities(file_get_contents('http://example.com/'));
echo $html;

I use DOM :

<?php
$doc = new DOMDocument();
$doc->loadHTML('http://example.com');
$exm = $doc->getElementsByTagName('a');
print_r($exm);
//will print DOMNodeList Object ( )
?>

I do not want to use "RegExp" it is not reliable most of the time if there are any ideas or tips to be provided I will be thankful

4

1 回答 1

1

使用DOM挖掘页面内容: http: //php.net/dom

于 2013-04-09T07:51:25.127 回答