Witam, mam problem z skryptem API upload od vshare.io. Odpalilem xamppa, apache i mysql tez, skrypt wrzuciłem do htdocs i gdy wpisze localhost/skrypt.php wyskakuje strona i error. Jeżeli ktoś mogłby mi pomóc z tym skryptem jak go odpalić i żeby pliki się wysyłaly na konto to byłbym bardzo wdzięczny.
Pozdrawiam
PS. O tokenie wiem.
<?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
if (function_exists('curl_file_create')) { // php 5.5+
$cFile = curl_file_create($file_path);
} else { //
$cFile = '@'.realpath($file_path);
}
$post = array(
'token'=>$token,
'filesize'=>filesize($file_path),
'Filedata'=>$cFile
);
// init
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://upload.vshare.io/upload_api.php?v=2');
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']; }
?>