I want to parse an XHTML content using CURL. How to scrap transaction number, weight, height, Width between <table>
tags. How to scrap only the contents from this HTML document and get it as array using CURL?
transactions.php
<table border=0 cellspacing=0 width=100%>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td width="30%" class="Mellemrubrikker">Transaction Number::</td>
<td width="70%">24752734576547IN</td>
</tr>
<tr>
<td width="30%" class="Mellemrubrikker">Weight:</td>
<td width="70%">0.85 kg</td>
</tr>
<tr>
<td width="30%" class="Mellemrubrikker">Length:</td>
<td width="70%">543 mm.</td>
</tr>
<tr>
<td width="30%" class="Mellemrubrikker">Height:</td>
<td width="70%">156 mm.</td>
</tr>
<tr>
<td width="30%" class="Mellemrubrikker">Width:</td>
<td width="70%">61 mm.</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table>
index.php
<?php
$url = "http://localhost/htmlparse/transactions.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
//print_r($output);
echo $output;
?>
This code gets whole html content from transactions.php . How to get data between <table>
as an array value ?