开发者

How to rip specific data from an HTML file?

so I have multiple HTML files which I need to get some praticular data from, I mean theres a bunch of non relative information in this HTML files, but I need just lets say things that 开发者_高级运维are between the <div class="myInfo"> and </div>, after getting this information I want to handle it in my own PHP page, so for example I can insert this data into some variables. Is it even possible using PHP only? (Forgive me for my English mistakes)


I would use SimpleDom

http://simplehtmldom.sourceforge.net/

// Find all article blocks
foreach(file_get_html('http://smysite.com')->find('div.myInfo') as $Info) {
    print_r($Info);
}

Alternative. http://php.net/manual/en/book.simplexml.php


I think you need to use CURL for that

Here is a link http://www.php.net/manual/en/book.curl.php

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜