[wp-hackers] is there a plug in that does browser's text view
Josh Keen
josh.keen.01 at gmail.com
Thu Apr 12 19:25:40 UTC 2012
try this:
http://simplehtmldom.sourceforge.net/index.htm
here's an example snippet that gives you the excerpts for a search on Julio
Iglesias:
<?php
//create and load the HTML
include('../simple_html_dom.php');
//$html = new simple_html_dom();
$html = file_get_html('https://www.google.com/search?q=julio+iglesias');
//echo '$html: '.$html;
foreach($html->find('div.s') as $element)
//echo $element->text . '<br>';
echo 'excerpt: ' . $element->plaintext . '<br /><br /><br />';
?>
Enjoy!
On Wed, Apr 11, 2012 at 12:08 PM, Haluk Karamete <halukkaramete at gmail.com>wrote:
> Is there a plug in ( or a php snippet you know of ) that extracts the text
> ( filtering down the HTML ) out of a url passed to it?
>
> Example:
>
> Check this link out
> http://www.aljazeera.com/news/middleeast/2012/04/2012410203742758407.html
>
> In its page body, it's got the following text;
>
> "Kofi Annan has urged the UN Security Council to help prevent the collapse
> of his efforts ..... "
>
> Which is the same text that you see when you google that article
>
> https://www.google.com/search?sourceid=chrome&ie=UTF-8&q=UN+urged+to+push+for+Syria+ceasefire
>
> The plan is that I write a script, that submits to google, gets into google
> html, parses the 1st link and gets that 55 word description out of it and
> then uses that extraction as a beginning delimiter in getting the 500
> characters from the destination article. I need that plug in and PHP code
> so that I can work with a cleaner/easier text to deal with.
>
> Ofcourse, I can get into the PHP's striptags function and create that
> snippet myself (but before I get my hands dirty with coding), I thought I
> double check with you guys.. maybe you guys know of a plug in - or suggest
> a better way. I thought of getting to the RSS text but I cannot find an
> RSS content search using google.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list