Api
People that is interested in using our service for automated caching of their newly created. torrent Files or caching mas sive amounts of older files, can do so by using one our APIs.
This page contains some documentation on the APIs but also some example code in different languages. If you have the some code for any additional language we don't cover, please give us some working example code over e-mail.
All files would be cached at http://torcache.net/torrent/<infoHash>.torrent
Note: HEX values a-f must is in uppercase in Torrent URL ' s
SOAP API
The SOAP API is probably, the most easy-to-use in a modern scripting/programming language. The WSDL offers one simply function; cachetorrent (). The function returns the info hash of the torrent on success, or a three digit error code if there is an error.
The SOAP WSDL is located at http://torcache.net/torcache.wsdl.
Php
Below is example code in the PHP to cache "My.torrent". You would need to compile PHP--with-soap.
$client New SoapClient (' http://torcache.net/torcache.wsdl ' ); $infoHash $client Base64_encode file_get_contents (' My.torrent ')) );
Perl
Perl code to cache "My.torrent". Requires SOAP::Lite (Libsoap-lite-perl in Debian)
#!/usr/bin/perl UseMime::Base64 (); UseSoap::Lite ();Open(FILE,'my.torrent') or die "$!"; while(Read(FILE,$buf, -* $) ) {$tor. = Mime::base64::encode ($buf ); }Close(FILE);$infoHash= Soap::lite->service ('http://torcache.net/torcache.wsdl')->cachetorrent ($tor );Print $infoHash;
HTTP POST
If you don't have the support for SOAP there is a normal HTTP POST interface. Here we show some example code for that as well.
Php
Below is example code to cache "My.torrent". This feature requires the pecl_http extension.
$files=Array( Array( ' Name ' = ' torrent ',//Don ' t change' Type ' = ' application/x-bittorrent ', ' file ' = ' my.torrent '//Full path for file to upload ) ); $http _resp= Http_post_fields (' http://torcache.net/autoupload.php ',Array(),$files ); $tmp=Explode("\ r \ n",$http _resp ); $infoHash=substr($tmp[Count($tmp)-1], 0, 40 ); unset($tmp,$http _resp,$files);
Share a "Wolf" API