php调取soap的webservice连接超时的问题


我有一个程序需要调取soap的webservice但有时提供webservice的服务器会被撤掉,但又未及时通知我们,会造成我调用这台服上的webservice的页面死掉,想问下大家有啥办法解决吗?

php soap

十六夜@咲夜 11 years, 5 months ago

在你soap 调用webservice前先检查url可执行,然后再soap调用:

   
  $handle = curl_init($url);
  
curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE);

$response = curl_exec($handle);
$httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
if($httpCode == 404) {
//执行退出操作
}

curl_close($handle);

//下面在执行soap调用

囧虚的兄贵 answered 11 years, 5 months ago

Your Answer