I am using CURL to generate data. Though the site is not providing any other format for extraction So what I have did simply paas the url and retrieving data in HTML this is my script is retrievning. Can I convert that html data to any other format like JSON or XML so it would easy for me to parse HTML in PHP. If I can't get data in JSON/XL how would I extract data that is parse it according to my relevance. I got some code to get it in json.
function get_json_content($json_url = '') {
$ch = curl_init($json_url);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json'),
CURLOPT_TIMEOUT => 160,
CURLOPT_FOLLOWLOCATION => 1
);
curl_setopt_array($ch, $options); // Setting curl options
$result = curl_exec($ch); // Getting jSON result string
return $result;
}
$json_url = 'http://www.evertek.com/viewpart.asp?auto=78053&cat=45#.UKZWHme5JI4';
$get_result = get_json_content($json_url);
die($get_result);
This $get_result
is receving in html. Please help me my motto is to extract or parse data in proper format no matter wheresoever format it is in. I just want to easily parse data so I can use it with PHP.