June 8, 2010
How to rip specific data from an HTML file?
Question by SnirD
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)
Answer by RobertPitt
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
Answer by Starx
I think you need to use CURL for that
Here is a link
http://www.php.net/manual/en/book.curl.php