Sunday 26 November 2017

php - how to parse contents from a html file using CURL?

I want to parse an XHTML content using CURL. How to scrap
transaction number, weight, height, Width between

tags. How to scrap only the
contents from this HTML document and get it as array
using
CURL?



transactions.php




colspan="2"> 





width="70%">24752734576547IN




















width="30%" class="Mellemrubrikker">Width:
width="70%">61 mm.








Transaction
Number::
Weight:0.85 kg
Length:543 mm.
class="Mellemrubrikker">Height:156
mm.
 



index.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

as an array value
?

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...

Blog Archive