有这个代码:
set_time_limit(100);
ini_set('user_agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:13.0) Gecko/20100101 Firefox/13.0.1');
ini_set('default_socket_timeout', 100);
ini_set('soap.wsdl_cache_enabled', 0);
echo '<plaintext style="font-size:20px;">';
$client = new SoapClient('http://www.test/?wsdl', array(
'soap_version' => SOAP_1_2,
'cache_wsdl' => WSDL_CACHE_NONE,
'use' => SOAP_LITERAL,
'style' => SOAP_DOCUMENT,
'user_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:13.0) Gecko/20100101 Firefox/13.0.1',
'connection_timeout' => 120
));
// $result = $client->ValidaRut(array(
$result = $client->__call('ValidaRut', array(
'rut' => 11111111,
'dv' => '1',
'cup' => '1',
'ipserver' => gethostbyname($_SERVER['SERVER_NAME']) ,
'ipcliente' => $_SERVER['REMOTE_ADDR']
));
但是不工作,php 说:致命错误:未捕获的 SoapFault 异常:[HTTP] Error Fetching http headers in /home/.../test.php:1
发生什么了?对不起我的英语。数据转储:
print_r($client->__getFunctions());
Array
(
[0] => ValidaRutResponse ValidaRut(ValidaRut $parameters)
)
print_r($client->__getTypes());
Array
(
[0] => struct ValidaRut {
double rut;
string dv;
string cup;
string ipserver;
string ipcliente;
}
[1] => struct ValidaRutResponse {
boolean ValidaRutResult;
}
[2] => int char
[3] => duration duration
[4] => string guid
)
安全模式已关闭。我使用 WHM/cPanel,安装了库。谢谢。