简单的perl脚本不适用于itorrents API(12行)



昨天我尝试用perl和itorents-api编写一个示例脚本,我使用的是perlIDE Padre。基本上,这个脚本将数据发送到服务器(itorents(——这是api的链接:itorents.org/automation我复制并粘贴了网站给我的代码,但它不起作用!我用windows cmd:安装了这个perl模块

cpan App:cpanminus
cpanm MIME::Base64
cpanm MIME::Parser
cpanm MIME::Tools
cpanm Test::XML
cpanm SOAP::Lite
cpanm SOAP::WSDL

这是我的脚本(cachech.pl(:

#!/usr/bin/perl

use MIME::Base64 ();
use SOAP::Lite ();

open( FILE, 'my.torrent' ) or die "$!";
while( read( FILE, $buf, 60*57 ) ) { $tor .= MIME::Base64::encode( $buf ); }
close( FILE );

$infoHash = SOAP::Lite->service( 'http://itorrents.org/api/torrage.wsdl' )->cacheTorrent( $tor );

print $infoHash;

提前谢谢,对不起,我的语言不流利。编辑:对不起,我忘记发布错误行:

Service description 'http://itorrents.org/api/torrage.wsdl' can't be loaded: 500 Can't connect to itorrents.org:443

已解决我从下载torrage.wsdl文件解决了这个问题http://itorrents.org/api/torrage.wsdl并替换了这一行:

$infoHash = SOAP::Lite->service( 'http://itorrents.org/api/torrage.wsdl' )->cacheTorrent( $tor );

使用此行(用下载的文件torrage.wsdl路径替换网站URL(:

$infoHash = SOAP::Lite->service( 'file:///C:/Users/sussq/Desktop/perl2exe/torrage.wsdl' )->cacheTorrent( $tor );

有关更多信息和解释,请参阅本文:SOAP::Lite可以';t连接到主机

最新更新