分享"狼用"API一個
API
People that are interested in using our service for automated caching of their newly created .torrent files or caching massive 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 some code for any additional language we do not cover, please give us some working example code over e-mail.
All files will be cached at http://torcache.net/torrent/<infoHash>.torrent
Note: HEX values A-F must be 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 was an error.
The SOAP WSDL is located at http://torcache.net/torcache.wsdl.
PHP
Below is example code in PHP to cache "my.torrent". You would need to compile PHP --with-soap.
$client = new SoapClient( 'http://torcache.net/torcache.wsdl' );
$infoHash = $client->cacheTorrent( 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
use MIME::Base64 ();
use SOAP::Lite ();
open( FILE, 'my.torrent' ) or die "$!";
* ) ) { $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 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 );
分享"狼用"API一個的更多相关文章
- 微信JS-SDK“分享信息设置”API及数字签名生成方法(NodeJS版本)
原文:微信JS-SDK"分享信息设置"API及数字签名生成方法(NodeJS版本) 先上测试地址以示成功: 用微信打开下面地址测试 http://game.4gshu.com/de ...
- 【C#】分享基于Win32 API的服务操作类(解决ManagedInstallerClass.InstallHelper不能带参数安装的问题)
注:这里的服务是指Windows 服务. ------------------201508250915更新------------------ 刚刚得知TransactedInstaller类是支持带 ...
- 【分享】DevDocs API Documentation
http://devdocs.io/ 这是一份综合性的在线API列表,很全,方便查找.
- 分享一个开源免费、目前最好的API接口管理平台----eoLinker
一.概况 eoLinker 是目前业内领先.国内最大的在线 API 接口管理平台,提供自动生成 API 文档.API 自动化测试.Mock 测试.团队协作等功能,旨在解决由于前后端分离导致的开发效率低 ...
- 微信WeixinJSBridge API(屏蔽右上角按钮等)
[声明]:我这份纯属于备份,为了自己将来用起来方便: [相关链接]:http://www.2cto.com/weixin/201511/451592.html(好不好用完全看这个文档的作者了) [感谢 ...
- 腾讯云>>云通信>>TLS后台API在mac上JAVA DEMO搭建
1.相关文档地址 2.相关demo代码 代码部分作了修改,使用了commons-io中的IOUtils.toString简化了io操作 public class Demo { public stati ...
- App Store有哪些原因会影响app应用上架呢?(分享)
App Store对于应用上架的审核是非常严格的,很可能一个没有注意到的细节,或者一个你根本没想想到的原因就会导致你的应用上架失败.而排除这些无可避免的错误以外,还有一些导致应用上架失败的原因,非常常 ...
- iOS----友盟分享完善版本
分享 详细集成 注意:1.线上集成文档的示例代码对应的是最新版本的SDK,如果你所用的SDK版本类名或者方法名与此文档不符合,请看随包里面的线下文档或者下载使用最新版本的SDK. 设置友盟appkey ...
- 【转】ASP.NET WEB API系列教程
from: 西瓜小强 http://www.cnblogs.com/risk/category/406988.html ASP.NET Web API教程(六) 安全与身份认证 摘要: 在实际的项目应 ...
随机推荐
- a标签的css样式四个状态的设计
表示所有状态下的连接 如 a{color:red} ① a:link:未访问链接 ,如 a:link {color:blue} ② a:visited:已访问链接 ,如 a:visited{color ...
- bzoj 1877: [SDOI2009]晨跑
#include<cstdio> #include<iostream> #include<cstring> #define M 6009 #define inf 2 ...
- EasyMock的原理及使用方法
就不费劲转过来了https://www.ibm.com/developerworks/cn/opensource/os-cn-easymock/这上面介绍的比较全.
- c#中使用servicestackredis操作redis
下载地址: https://github.com/mythz/ServiceStack.Redis 添加dll引用: using ServiceStack.Common.Extensions;usin ...
- Hibernate 的配置文件
Hibernate 配置文件 •Hibernate 配置文件主要用于配置数据库连接和 Hibernate 运行时所需的各种属性 •每个 Hibernate 配置文件对应一个 Configuration ...
- SVN Unable to connect to a repository at URL
方法一:右键菜单的“TortoiseSVN”->“Settings”->“Save Data”对话框中,点击“Authentication data”旁的“Clear”按钮,清除登录凭证. ...
- JS获取上传文件的名称、格式、大小
<input id="File1" type="file" onchange="checkFile(this)" /> 方式一) ...
- matlab 画框(一)
matlab进行图像处理之后,很多时候需要在图像上画出矩形框:如,调用matlab的某个检测函数,得到结果之后,往往需要将检测结果的矩形框画在图像上,直观.方便的进行查看:下面的代码就是这个目的: f ...
- dialog参数、方法以及事件
参数(options) DOM方式初始化dialog的,推荐使用集合属性data-options定义参数,如果使用data属性定义参数,注意转换成对应的名称. 名称 类型 默认值 描述 id stri ...
- Android 自带图标库 android.R.drawable
在xml文件中调用. android:title="@string/secure_connect"android:orderInCategory="100"an ...