Introduction: this is a simple Code page for retrieving page information from PHP, PHP, PhP100, contents, WWW knowledge, skills, experience, and some PHP Source Code related to simple code for capturing page information in PHP.
class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 357331 'rolling = 'no'>
? Use the PHP Dom function to capture simple single-page information (here we do our best to capture the tag, the function is implemented, but the extension Page Link crawling is not implemented, you are welcome to criticize and guide)
error_reporting (e_error);
$ pages = file_get_contents ('HTTP: // www.php100.com ');
// $ pages = htmlspecialchars ($ pages);
$ Doc = new domdocument ();
$ new_doc = new domdocument ('1. 0 ', 'utf-8');
$ doc-> loadhtml ($ pages );
$ dom = $ doc-> getelementsbytagname ('A');
for ($ I = 0; $ I <$ dom-> length; $ I ++) {
$ node = $ new_doc-> createelement ('A ', $ dom-> item ($ I )-> Nodevalue);
$ newnode = $ new_doc-> appendchild ($ node);
$ newnode-> setattribute ('href ', $ dom-> item ($ I)-> getattribute ('href ');
$ newnode-> setattribute ('style', 'display: block; margin-left: 30px; '); // echo $ dom-> item ($ I)-> getattribute ('src '). '
';
}< br>
echo $ new_doc-> savehtml ();
?>
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/357331.html pageno: 2.