[wp-hackers] is there a plug in that does browser's text view

Josh Keen josh.keen.01 at gmail.com
Thu Apr 12 21:27:56 UTC 2012


I left it in by accident. I was playing with a couple different examples
and I forgot to delete the unused code. The function get_file_html
apparently returns  an object that has the find method. I guess you don't
need to instantiate simple_html_dom directly, *or at least not in this in
this simple example.* I just tested it again---it works.

Hope this helps!

On Thu, Apr 12, 2012 at 12:40 PM, Haluk Karamete <halukkaramete at gmail.com>wrote:

> Thank you. These are the stuff that makes you want to be a programmer
> right?
> I cannot try it now but for sure in the next 2 days.
>
> But for the time being, why did you comment this;
>
>   //$html = new simple_html_dom();
>
>
> On Thu, Apr 12, 2012 at 12:25 PM, Josh Keen <josh.keen.01 at gmail.com>
> wrote:
>
> > 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
> > >
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> 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