开发者

Parse text from an HTML page

I know it is possible to get information (text) from another page.

Fo开发者_StackOverflow社区r example, on the page at http://www.page.com/ is a div named news. How can I get the text from this div?


Yes, that's what HTML Simple DOM is for amongst other options.

Example:

$html  = file_get_html('http://www.page.com/');
$mydiv = $html->find('div[id=news]', 0)->plaintext;


Use an HTML parser.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜