简体   繁体   中英

PEAR SOAP_client error

I am getting the error

The named parameter torrent is not in the call parameters.

for Pear SOAP_client & Torcache API

here is my code

$client = new SOAP_Client ( 'http://torcache.net/torcache.wsdl' );
$infoHash = $client->cacheTorrent( base64_encode( file_get_contents( 'mytorrent' ) ) );
echo ($infoHash);

this was linked from their API page; https://torcache.net/api

I am a little confused as how to proceed from here? any suggestions?

A quick debug of the web service using PHP5's SoapClient instead of the PEAR one like so:

$client = new SoapClient ( 'http://torcache.net/torcache.wsdl' );
var_dump($client->__getFunctions());

yieds the following:

array(1) { [0]=> string(36) "string cacheTorrent(string $torrent)" }

Looking at their code sample what this means is that you need to pass in the base64-encoded contents of an actual .torrent file. Based on the function signature, and previous experience with SOAP web services, I think you should try adjusting your code to:

$client = new SOAP_Client ( 'http://torcache.net/torcache.wsdl' ); 
echo ($infoHash);$infoHash = $client->cacheTorrent( array('torrent' => base64_encode(file_get_contents('test.torrent')) ) );

You will need to make sure you actually have a torrent file by the name test.torrent in the same directory as this script.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM