PHP file sharing site upload error

I currently have the following code.

error_reporting(E_ALL);
ini_set('display_errors', 1);    
include('simple_html_dom.php');
$df = upload('username','password','song.mp3','song.mp3');
$df = json_decode($df, true);

function upload($login,$password,$filename,$file) { 
    $ch = curl_init();
    $postData = array(
        'op' => 'login',
        'login' => $login,
        'password' => $password,
        'returnto' => '/'
    );
    curl_setopt_array($ch, array(
        CURLOPT_URL => 'http://dopefile.pk/login.html',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => $postData,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_COOKIESESSION => true,
        CURLOPT_COOKIEJAR => 'cookie.txt'
    ));
    $output = curl_exec($ch);

    curl_setopt($ch, CURLOPT_URL, "http://dopefile.pk/?op=upload");
    $output = curl_exec($ch);
    $html = str_get_html($output);
    $ret1 = $html->find('form[id=uploadfile]'); 
    $ret = $html->find('form[id=uploadfile] input');
    foreach($ret AS $r) { 
        $newPost[$r->name]=$r->value;
    }
    $newPost['file_0'] = '@'.$file.';filename='.$filename;
    curl_setopt_array($ch, array(
        CURLOPT_URL => 'http://dopefile.pk/cgi-bin/upload.cgi?upload_type=file',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => $newPost,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_COOKIESESSION => true,
        CURLOPT_COOKIEJAR => 'cookie.txt'
    ));
    return $output = curl_exec($ch);
}

      

What is trying to upload a file song.mp3

that is in my directory to a file sharing site , and then return the link to the file sharing sites (if you download simple_html_dom.php , and try running this code above, you can see that it does not return any errors or returns file sharing link + doesn't upload to my account on website ...

Cookies are updated with cookies that show that I have successfully logged in, how could I not get the actual link to the file, can anyone help me?

+3


source to share





All Articles