php的html解析工具 PHP Simple HTML DOM Parser

高泳
2023-12-01

地址:

http://simplehtmldom.sourceforge.net/

 

 

// Create DOM from URL or file
$html = file_get_html ('http://www.google.com/' );

// Find all images
foreach($html->find ('img' ) as $element)
       echo $element->src . '<br>' ;

// Find all links
foreach($html->find ('a' ) as $element)
       echo $element->href . '<br>' ;

 

 

 类似资料: