我正在尝试将简单的cURL上传到hugefiles.net,但没有运气。
我已手动设置$ data ['srv_tmp_url'](希望可以这样做)以及upload_id参数,以避免现在任何页面抓取。
当脚本执行时它会将我重定向到下载链接,但该链接上的文件只包含大约25个B. 这是代码,希望有人可以尝试这一点,并指出我正在犯的错误,谢谢。
<?php
function Upload_curl($url,$data)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, 1000);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_REFERER, "http://hugefiles.net/");
$result = curl_exec($ch);
return $result;
}
$filename = "test.rar";
$data = array();
$data['upload_type'] = "file";
$data['srv_tmp_url'] = "http://us02.hugefiles.net/tmp";
$data['file_0; filename="'.$filename.'"'] = "@C:/xampp/htdocs/test.rar";
//$data["sess_id"] = "";
echo Upload_curl("http://us02.hugefiles.net/cgi-bin/upload.cgi?upload_id=310423971419&js_on=1&utype=&upload_type=file",$data);
?>