webtor/platform-sdk-php

在线种子流式传输的SDK

v0.1.5 2020-09-12 11:23 UTC

This package is auto-updated.

Last update: 2024-09-12 20:01:25 UTC


README

Webtor.io平台在线种子流式传输SDK

安装

composer require webtor/platform-sdk-php

grpcprotobuf pecl 扩展必须安装,只需遵循 此指南

基本用法

<?php
require __DIR__ . '/vendor/autoload.php';

$torrentUrl = 'https://github.com/webtorrent/webtorrent.io/blob/master/static/torrents/sintel.torrent?raw=true';
$data = file_get_contents($torrentUrl);

$sdk = new Webtor\SDK([
    'apiUrl'           => 'https://api.webtor.io',
    // 'grpcAddr'         => '127.0.0.1:50051',
    'grpcAddr'         => 'grpc.webtor.io:443',
    'apiKey'           => 'your_api_key',
    'secret'           => 'your_secret',
    'grpcCredentials'  => \Grpc\ChannelCredentials::createSsl(),
]);

$infoHash = $sdk->torrent()->push($data);
$url = $sdk->seeder($infoHash)->url('/Sintel/Sintel.mp4');
echo($url);

完整示例可以在 此处 找到。

身份验证

如果你在自己的服务器上托管webtor实例,无需提供API密钥和密钥。只需遵循 此指南 来设置。

进行中

目前PHP SDK不提供完整的功能,如JavaScript版本。但会。