无论如何,SoapClient 请求是否会超时并抛出异常。截至目前,我得到 PHP 服务器响应超时,在我的例子中是 60 秒。基本上我想要的是,如果在一定时间内没有来自 Web 服务的任何回复,则会抛出一个异常,我可以捕获它。 60 秒警告不是我想要的。
最佳答案
ini_set("default_socket_timeout", 15);
$client = new SoapClient($wsdl, array(......));
The connection_timeout option defines a timeout in seconds for the connection to the SOAP service. This option does not define a timeout for services with slow responses. To limit the time to wait for calls to finish the default_socket_timeout setting is available.
关于PHP SoapClient 超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3500527/