apiperlidesendtorrent

Simple perl script doesn't work with itorrents API (12 LINES)


yesterday i tried to code an example script with perl and itorrents api, i'm using the perl IDE Padre. Basically, this script sends data to a server (itorrents) here's the link of the api: itorrents.org/automation i copied and pasted the code that the website gived to me, and it's not working! I installed this perl modules with windows cmd:

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

This is my script (caching.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;

Thanks in advance, im not fluent in this language, sorry. Edit: sorry i forget to post the error line:

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

Solution

  • Solved ! I solved it downloading the torrage.wsdl file from http://itorrents.org/api/torrage.wsdl and replaced this line:

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

    With this line(replacing the website URL with the downloaded file torrage.wsdl path):

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

    For more information and explanation see this post: SOAP::Lite can't connect to host