Fetch website data using curl in php -
i getting website data using curl in php issue not able desired website data .it showing data of home page.
<?php $url="http://fdating.com/"; function gethtml($url,$timeout) { $ch = curl_init($url); // initialize curl given url curl_setopt($ch, curlopt_useragent, $_server["http_user_agent"]); // set useragent curl_setopt($ch, curlopt_returntransfer, true); // write response variable curl_setopt($ch, curlopt_followlocation, true); // follow redirects if curl_setopt($ch, curlopt_connecttimeout, $timeout); // max. seconds execute curl_setopt($ch, curlopt_failonerror, 1); // stop when encounters error return @curl_exec($ch); } $resp=gethtml($url,200); $xml = simplexml_load_string($resp); $arr = json_decode( json_encode($xml) , 1); print_r($arr); ?>
Comments
Post a Comment