Share a "Wolf" API

Source: Internet
Author: User
Tags http post soap wsdl

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.