0
我试图通过api上传文件到vshare.io。启动时,它会为约1分钟运行脚本,然后将打印PHP - 上传脚本中的神秘错误
<?php
if(!function_exists('curl_init')) {
die('CURL functions are not available. Debian: apt-get install php5-curl');
}
$file_path = ''; // Example: $file_path = '/home/files/file.exe';
$token = ''; // You can get your TOKEN from the following page http://vshare.io/api.html
$post = array(
'token' => $token,
'filesize' => filesize($file_path),
'Filedata' => '@' . $file_path
);
// init
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://upload.vshare.io/upload_api.php');
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Expect: "));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$result = curl_exec($ch);
curl_close($ch);
$output = json_decode($result, TRUE);
if(isset($output['upload'], $output['video'], $output['fileid']) && strlen($output['fileid']) == 7 && $output['upload'] == 1) {
if($output['video'] == '1') {
$file_type = 'video';
} elseif($output['video'] == '0') {
$file_type = 'file';
}
echo 'File Type: ' . $file_type . ' | File Link: http://vshare.io/d/' . $output['fileid'];
} else {
echo 'Error: ' . $output['msg'];
}
?>
我插入我的令牌,并在Ubuntu正确的文件路径,但是:他们提供一个PHP脚本这样做的“错误” (脚本的最后一行说这样做)。没有文件上传到我的帐户
任何提示?
添加既剧本,但得到相同的输出:(这可能是因为这个\t \t \t \t $结果= curl_exec($ CH);我注意到,有curl_close命令,但执行被封装在$ result中 – user3919889
您是否尝试转储$ result,您收到了什么?NULL消息? –
如果我这样做,脚本将永远阻止永远(lol)。 ,我必须退出CTRL + Z – user3919889