分享"狼用"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教程(六) 安全与身份认证 摘要: 在实际的项目应 ...
随机推荐
- treap codevs 4543普通平衡树
#include<cstdio>#include<ctime>#include<cstdlib>struct shu{ int l,r,sum1,zhi,dui,s ...
- ios应用数据存储的常用方式 ios7.1应用沙盒
归档:用某种格式保存某个对象,又称持久化. 1XML 属性列表plist归档(持久化) 2Preference(偏好设置) 3NSKeyedArchiver归档 4SQLite3 5Core Data ...
- C++全局变量在多个源代码文件中的使用
在比较大的项目中,如果需要使用全局变量,那么就需要注意一些全局变量声明.使用不当引起的问题了. 本篇文章主要内容有两个:普通全局变量.静态全局变量.全局常量. 1.普通全局变量:假设我们需要在多个不同 ...
- idea修改jsp后不会自动编译和替换(转)
使用IntelliJ IDEA开发JavaWeb项目时,修改了JSP后刷新浏览器无法及时显示修改后的页面? 解决办法:tomcat配置中,On frame deactivation属性选择Update ...
- == 和 isEqualToString的区别之备忘
== 比较的是指针 isEqualToString 比较的是指针指向的内容 比如: NSString * strA = @"abc"; NSString * strB = @&qu ...
- JS设计模式书籍、原则
圣经书:JavaScript 高级程序设计 设计模式:DesignPatterns by Erich Gamma.Richard Hlem.Ralph Johnson .Jhon Vlissides ...
- 给伪类设置z-index= -1;
.column{ position: relative; float: left; padding: 30px 0; width: 25%; z-index: 0; background-color: ...
- 找不到库文件地址,修改修改方法framework
直接双击地址行修改
- windows8.1 plsql连接oracle
http://pan.baidu.com/share/link?shareid=3782452820&uk=3557941237 http://pan.baidu.com/share/link ...
- FineUI疑难杂症
1. 导出excel操作:因为fineui里的按钮自带异步功能,所以要把 EnableAjax="false" DisableControlBeforePostBack=" ...