Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#119 Can't get elements by chaining classes

v1.0_(example)
open
nobody
None
1
2013-02-05
2013-01-05
Tam Vo
No

Hi,

Thanks for your contribution, this library is pretty cool and I love it, it helps my job a lot. But, I found the bug in your library, I can't get elements by chaining element by using:
$html = str_get_html($client->
$a = $html->find(".milestone.okay.tooltipEl");

But $a is empty set, while I use jQuery and can get the elements by above selector.
Thanks

Discussion

  • John Schlick
    John Schlick
    2013-01-05

    $html = str_get_html($client->
    is invalid php - so... it's clear that you will never get results from the code you posted. We also have no idea what you meant with "$client->" or what html is contained in it.

    Please post an example of simple_html_dom failing using the new tester in the example/example_scraping_general.php

    include the webpage/url that you are getting, and then include a line that shows the issue.

     
  • Tam Vo
    Tam Vo
    2013-01-11

    Sorry for my mistake in above snippet. For example, I have simple dom element like this:

    After load source to simple dom, I want to get above element:
    $html->find(">

    But I can't get any element, although as you can see, we can get above element by jQuery with this query: $(".class1.class2.class3"), right? I also take a look in your examples in the source, but can't find any similar example.

    Thanks for your consideration,

     
  • Use: $a = $html->find('.milestone.okay.tooltipEl', 0);

     
  • Use for .class .class .class: $a = $html->find('.class .class .class', 0);