php - Unable to get actual html in JSON result when accessing import.io API via cURL -
when access import api manually in browser copying api-url proper json result html fields have html results. however, when access same api url via curl php in following json result: {"name":"my_html","type":"html"}
..so without actual html.
i use following function curl api in php:
public function queryio($connectorguid,$url,$input,$userguid,$apikey) { $io_url = "https://api.import.io/store/data/".$connectorguid."/_query?input/webpage/url=".urlencode($url)."&_user=" . urlencode($userguid) . "&_apikey=".$apikey; $ch = curl_init(); $timeout = 5; curl_setopt($ch,curlopt_url,$io_url); curl_setopt($ch,curlopt_returntransfer,1); curl_setopt($ch,curlopt_connecttimeout,$timeout); $data = curl_exec($ch); curl_close($ch); return $data; }
my question how can actual html? btw, works fine other fields text, date/time, etc.
try removing
curl_setopt($ch,curlopt_connecttimeout,$timeout);
Comments
Post a Comment