错误:连接失败到92.51.76.186:8085;拒绝连接

时间:2018-06-07 10:56:39

标签: php json rest api curl

这个休息api在broweser工作而不是CURL,你能告诉我原因吗?

错误:连接失败到92.51.76.186:8085;连接被拒绝

$url = 'http://92.51.76.186:8085/FINAPublicService/PublicService.svc/GetProductsRest';  
$ch = curl_init();  
curl_setopt($ch, CURLOPT_URL,$url);  
curl_setopt( $ch, CURLOPT_URL, $url );  
curl_setopt( $ch, CURLOPT_TIMEOUT, 10 );  
curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );  
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION,1);    
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);  
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);  
curl_setopt($ch, CURLOPT_HTTPGET,1);  
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");  
curl_setopt($curl, CURLOPT_FAILONERROR, true);   
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);   
$result = curl_exec($ch);   
if (curl_errno($ch)) {  
    echo 'Error:' . curl_error($ch);  
}else{  
    var_dump($result);  
}  
curl_close ($ch);    

0 个答案:

没有答案