Re: Static and/or Dynamic site scraping using PHP
| From: | Shawn McKenzie | Date: | Thu, 30 Apr 2009 15:00:22 +0000 |
| Subject: | Re: Static and/or Dynamic site scraping using PHP | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-292156@lists.php.net to get a copy of this message | ||
9el wrote:
> On Thu, Apr 30, 2009 at 3:33 AM, 9el <lenin@phpxperts.net> wrote:
>> I just got a project to do on PHP of scraping the body items from
>> static sites or just html sites.
>> Could you experts please suggest me some quick resources?
>>
>> I have to make an WP plugin with the data as well.
>
> Any expert there yet? Was looking for urgent advices on accomplishing the task.
>
> Thanks
>
> Lenin
>
> www.twitter.com/nine_L
If you're just capturing and using the body, the load with
file_get_contents() and use preg_match() to select the body or
individual tags, etc... For more control, maybe try this:
$doc = new DOMDocument();
$doc->loadHTMLFile('http://example.com/page.html');
Then use: http://php.net/manual/book.dom.php
--
Thanks!
-Shawn
http://www.spidean.com