以下脚本使用 kat.ph 上传 api 上传种子;但是,当我使用 echo 找出问题所在时,我收到了一个找不到文件的错误,为什么文件没有被上传,因为我可以在我的目录中看到该文件
<?php
$dhandle = opendir('.');
error_reporting(E_ALL);
$length = ob_get_length();
$katphdata ['desc'] = 'torrentdescription';
$katphdata ['name'] = 'testingscript';
$katphdata ['category_name'] = '38';
$katphdata ['torrentFile'] = 'name.torrent';
$katphdata ['userhash'] = 'hash';
foreach ( $katphdata as $key => $value) {
$post_items[] = $key . '=' . $value;
}
$post_string = implode ('&', $post_items);
$curl_connection = curl_init('http://kat.ph/torrents/upload/');
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt ($curl_connection, CURLOPT_HTTPHEADER, array("Content-Type: application/x-bittorrent", "Content-Length: $length"));
curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_items);
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl_connection,CURLOPT_ENCODING,"gzip");
curl_setopt($curl_connection, CURLOPT_POST, true);
$result = curl_exec($curl_connection);
return $result;
var_dump($result);
//show information regarding the request
print_r(curl_getinfo($curl_connection));
echo curl_errno($curl_connection) . '-' .
curl_error($curl_connection);
//close the connection
curl_close($curl_connection);
?>
这是他们的洪流上传表格
<input type="file" class="primary inputfile" name="torrentFile" /> <div class="goodalertfield inlineblock">You can upload only <strong>*.torrent</strong> files</div>
<br />