cURL and get some <tr> from table

I need to get some content from external URL. I have setup a cURL and try to get data from

in a table.


My code just now:
$url = “”;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$html = curl_exec($ch);

$data = file_get_contents($url);

$dom = new domDocument;

$dom->preserveWhiteSpace = false;
$tables = $dom->getElementsByTagName(‘table’);

$rows = $tables->item(2)->getElementsByTagName(‘tr’);
foreach ($rows as $row) {
$cols = $row->getElementsByTagName(‘td’);


How can i get every row from the table?

Sponsor our Newsletter | Privacy Policy | Terms of Service