I'm receiving some data from cURL and want to grab informations so i can save in another database.
The result of the cURL is a hole html page, so i'm using Simple HTML DOM Parser to get what i want. The problem is, i want the values of a table, but i'm getting just the tittles.
Here's the page:
<div id="conteudo">
<body>
<div id="tab">
<ul>
<li><a href="#tabs-a">Test1</a></li>
<li><a href="#tabs-b">Test2</a></li>
<li><a href="#tabs-c">Test3</a></li>
</ul>
<div id="tabs-1">
<div>
<table id="d1" name="d1">
<tbody>
<tr>
<td width="15%">Name:</td><td>
<form method="POST" id="form" action="index.php#tabs-1" >
<input name="txtName" type="text">
<input name="btn" value="ok" id="btn" type="submit">
</form>
</td>
</tr>
<tr>
<td>Name:</td>
<td><b>John</b></td>
<td>Age:</td>
<td>20</td>
</tr>
<tr>
<td>Father:</td>
<td>Locke</td>
<td>Mother:</td>
<td>Felicity</span>
</td>
</tr>
<tr>
<td>Adress:</td>
<td>Ok</td>
<td>City:</td>
<td>New York</td>
</tr>
</table>
...
What i'm trying:
$table = $html->find('table', 4);
$rowData = array();
foreach($table->find('tr') as $row) {
// initialize array to store the cell data from each row
$flight = array();
foreach($row->find('td') as $cell) {
// push the cell's text to the array
$flight[] = $cell->plaintext;
}
$rowData[] = $flight;
}
echo '<table>';
foreach ($rowData as $row => $tr) {
echo '<tr>';
foreach ($tr as $td)
echo '<td>' . $td .'</td>';
echo '</tr>';
}
echo '</table>';
What i'm getting:
Name:
Father:
Mother:
The problem is, i'm not getting the whole data.. Just the tittles, can you see?