I am trying to get one specific css class from my DOM object. I use simplehtmldom library.
1) The library
2) Because my localhost doesnt support fopen for some reason, I use the CURL library to get the HTML, source:
http://simplehtmldom.sourceforge.net/manual_faq.htm
3) Now, my script looks like this. It gives me source of HTML from the website which I desire.
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://hokejbal.cz/1-liga/tabulky/");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
print $result;
str_get_dom;
$ret = $html->find('.standings tablesort tablesorter tablesorter-default');
?>
4) Now, I want to get just a part of the website. Exactly this table:
<table class="standings tablesort tablesorter tablesorter-default">
I found it in Google Chrome webmaster tools
Unfortunately, when I run the script, I get whole HTML page, not just the desired part. What am I doing wrong?
The selector would be '.standings.tablesort.tablesorter.tablesorter-default'
Update: Try the below code.
<?php
$html = file_get_html('http://hokejbal.cz/1-liga/tabulky/');
$ret = $html->find('table.standings', 0);
print $ret;
?>