networking - php curl response blank randomly -
we implementing api curl. send xml request , xml response. cases randomly did not receive response. when co-ordinated api provider told there no request hit on there server in case of blank response.
how know, not hit on api provider server. there header response ?
some troubleshooting curl options:
curl_setopt($ch, curlopt_connecttimeout, 100); curl_setopt($ch, curlopt_timeout,100); curl_setopt($ch, curlopt_failonerror,true); curl_setopt($ch, curlopt_encoding,""); curl_setopt($ch, curlopt_verbose, true); curl_setopt($ch, curlinfo_header_out, true); curl_setopt($ch, curlopt_header, true);
get results
$data = curl_exec($ch); if (curl_errno($ch)){ $data .= 'retreive base page error: ' . curl_error($ch); } else { $skip = intval(curl_getinfo($ch, curlinfo_header_size)); $responseheader = substr($data,0,$skip); $info = curl_getinfo($ch); $requestheader = $info['request_header']; $info = var_export($info,true); echo "<pre>$requestheader \n\n $responseheader\n\n $info \n $data";
Comments
Post a Comment