SOAP API未捕获SoapFault异常

时间:2015-01-03 09:41:34

标签: php soap

我尝试使用他们的SOAP API将torrent上传到torcache.net。

<?php
$client = new SoapClient('http://torcache.net/torcache.wsdl');
$info_hash = $client->cacheTorrent(base64_encode(file_get_contents('test.torrent')));

print_r($info_hash);
?>

这是我收到的内容:

Fatal error:  Uncaught SoapFault exception: [HTTP] Not Found in D:\Web\data\localweb\test.php:4
Stack trace:
#0 [internal function]: SoapClient-&gt;__doRequest('&lt;?xml version=&quot;...', 'http://torcache...', 'urn:xmethods-de...', 1, 0)
#1 D:\Web\data\localweb\test.php(4): SoapClient-&gt;__call('cacheTorrent', Array)
#2 D:\Web\data\localweb\test.php(4): SoapClient-&gt;cacheTorrent('ZDg6YW5ub3VuY2U...')
#3 {main}
  thrown in D:\Web\data\localweb\test.php on line 4

1 个答案:

答案 0 :(得分:0)

参考this,看看您是否可以获得任何帮助。

试试这个:

<?php 
try {  
    $x = @new SoapClient("http://torcache.net/torcache.wsdl");  
} catch (Exception $e) {  
    echo $e->getMessage(); 
} 
?>