Status
Not open for further replies.

ciaociao4

Active Member
396
2011
26
0
:D

i use a script to upload on the filehost...like fileserve filesonic etc..etc...

now i need to convert to allow the upload to netload...

netload have api but i dont know how use this...



example of the part of the script to upload to...
for an example

PHP:
 function upUL($value, $usr, $pass, $client){
$filename = basename($value);

$cookieFile = $client.'_Uploaded.to.txt';
$url = "http://uploaded.to/io/login";
$post['id'] = $usr;
$post['pw'] = $pass;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR,$cookieFile);
$result = curl_exec ($ch);
curl_close ($ch);

$page = pHCJ("http://uploaded.to/home","",$cookieFile);
$script = pHCJ("http://uploaded.to/js/script.js","",$cookieFile);
$editKey = generate(6);
$serverUrl = cut_str($script, 'uploadServer = \'', '\'') . 'upload?admincode=' . $editKey . '&id=' . $usr . '&pw=' . sha1($pass);

$fpost['Filename'] = "$filename";
$fpost['Upload'] = 'Submit Query';
$fpost['Filedata'] = "@$value";
pHCJ($serverUrl,    $fpost,        $cookieFile);

sleep (10);
$page = null;
$search['page'] = 0;
$search['limit'] = 5;
$search['order'] = 'date';
$search['search'] = $filename;
$page = pHCJ("http://uploaded.to/io/me/list/files",    $search, $cookieFile);
$json = substr($page, strpos($page, '{"list'));
$linkInfo = json_decode(trim($json));
$linkInfo = $linkInfo->list[0];
$tmp = $linkInfo->id;

if ($tmp = null){$link=null;}
else{$link = 'http://ul.to/' . $linkInfo->id . "/" . $filename;}
return $link;
}




someone can help me to add the netfile upload function?

thanks :D
 
Last edited:
24 comments
if uploaded.to still working just stick to that until they shutting down :D
because we cant be sure what next hosting will down next
the hosting world still in chaos :D
 
Try this code:

PHP:
function upNetLoad($value, $usr, $pass){
// Soft2050
$filename = basename($value);

$url = file_get_contents('http://api.netload.in/getserver.php');
$post = Array ('modus' => 'file_upload', 'auth' => '' , 'user_id' => $usr , 'user_password' => $pass);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec ($ch);
curl_close ($ch);

if (preg_match("/upload_failed/", $result) || preg_match("/prepare_failed/", $result)) {
    return 'Upload failed.';
}
else if (preg_match("/UPLOAD_OK/", $result)) {
    $arr = explode(';', $result);
    /*
    $arr[0] : UPLOAD_OK
    $arr[1] : FILENAME
    $arr[2] : FILESIZE
    $arr[3] : DOWNLOAD LINK
    $arr[4] : DELETE LINK
    */
    return $arr[3];
}

}

Usage example:
PHP:
echo upNetLoad(realpath('file.rar'), 'user', 'password');
 
Try this code:

PHP:
function upNetLoad($value, $usr, $pass){
// Soft2050
$filename = basename($value);

$url = file_get_contents('http://api.netload.in/getserver.php');
$post = Array ('modus' => 'file_upload', 'auth' => '' , 'user_id' => $usr , 'user_password' => $pass);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec ($ch);
curl_close ($ch);

if (preg_match("/upload_failed/", $result) || preg_match("/prepare_failed/", $result)) {
    return 'Upload failed.';
}
else if (preg_match("/UPLOAD_OK/", $result)) {
    $arr = explode(';', $result);
    /*
    $arr[0] : UPLOAD_OK
    $arr[1] : FILENAME
    $arr[2] : FILESIZE
    $arr[3] : DOWNLOAD LINK
    $arr[4] : DELETE LINK
    */
    return $arr[3];
}

}
Usage example:
PHP:
echo upNetLoad(realpath('file.rar'), 'user', 'password');


thanks...i love you...but somwthings not work :D

i retry tonight...
 
yes...the auth...

i use this but give error...

upload error....

it's possible that i must indicate the rar password?

i think it's necessary in netload...


ps. sborg dont work with netload ...it give login error...
 
You would have to give the password for the archive if it is password protected. In that case, the code above won't work. You have to get the token and then post again the password or post the password with the first upload request only
 
You would have to give the password for the archive if it is password protected. In that case, the code above won't work. You have to get the token and then post again the password or post the password with the first upload request only


i try with password and without it...but not work...
 
PHP:
function upNetLoad($value, $usr, $pass){
// Soft2050

$url = file_get_contents('http://api.netload.in/getserver.php');
$post = Array ('modus' => 'file_upload', 'file_link' => "@$value", 'auth' => '', 'user_id' => $usr , 'user_password' => $pass);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec ($ch);
curl_close ($ch);

if (preg_match("/upload_failed/", $result) || preg_match("/prepare_failed/", $result)) {
    return 'Upload failed.';
}
else if (preg_match("/UPLOAD_OK/", $result)) {
    $arr = explode(';', $result);
    /*
    $arr[0] : UPLOAD_OK
    $arr[1] : FILENAME
    $arr[2] : FILESIZE
    $arr[3] : DOWNLOAD LINK
    $arr[4] : DELETE LINK
    */
    return $arr[3];
}

}
After testing the script, i noticed there was a mistake in netloads documentation
Its given as file => file_link in there documentation though the reverse of it works i.e. file_link => file

Tested the script now without password and it works :)
 
Status
Not open for further replies.
Back
Top