分享"狼用"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教程(六) 安全与身份认证 摘要: 在实际的项目应 ...
随机推荐
- jquery判断多选框是否选中
if($("#xieyi").is(":checked")){ alert('选中'); }else{ alert('没有选中') }
- 可滑动的ToggleButton(开关)
2013-12-28 17:25:01 网上看到一篇关于可滑动的ToogleButton的文章,有代码,觉得挺好,但是不符合我的要求,因此在他的代码基础上改了一些.(作者看到了勿喷啊,实在找不到原文了 ...
- struts中的数据校验
1.struts中如何进行数据校验 在每一个Action类中,数据校验一般都写在业务方法中,比如login().register()等.struts提供了数据校验功能.每个继承自ActionSuppo ...
- JQery w3school学习第一章 标签的隐藏和显示
鄙人初学JQuery,最关键的是JQuery获取标签对象的方式 这一章学习的是点击按钮让所有标签的文字以及标签栏的位置隐藏起来,因为单纯的隐藏文字,还是会有空格和空行的影响 这里最关键的代码就是 $( ...
- 启动BPM的5个步骤
在大部分业务中,我们通常认为:一个主要的业务流程管理项目从设计时间开始会比较好.我们知道很多方式来提高效率,增加生产力以及简化我们员工的工 作 - 这正是业务流程管理所做的.不幸的是,不管我们意图多好 ...
- 【转】linux下如何查看某个软件 是否安装?安装路径在哪
以redhat\centos 中php-mysql为例1:如果包是通过yum或者rpm方式安装[root@localhost yum.repos.d]# rpm -qa //找出系统所有的包,找到对应 ...
- 创建plist文件
可以先在工程中直接新建一个plist文件,往里面写入自己需要的数据.但是这里的plist文件我们无法修改,是只读的,我们可以将这个plist文件复制一份到沙盒中,然后对沙盒中的文件进行操作.具体代码如 ...
- 修改Azure Website 移动服务 默认时区
Azure Website 默认时区为国际标准时间,对中国用户来说不太方便友好,如何设置成北京时间呢? 打开Azure Website的“配置”页,找到“应用设置”节点. 在应用设置中添加设置项,密钥 ...
- 新版的tomcat里面get请求通过http协议的时候似乎默认是UTF-8的编码了吗?
不在servler.xml的connector中添加URICoding=“UTF-8”,使用默认值一样没有乱码,而添加URICoding=“iso-8859-1”就是乱码了. POST请求还是用iso ...
- 嵌入dll到rtf文件
嵌入文件到doc文件中, 打开word--->插入菜单---->对象--->新建---->对象类型----->Package---->弹出创建软件包界面-----& ...