public function Upload($callback)
 {
     $this->Login();
     if (isset($this->SID)) {
         // get the upload SID and url
         parent::curly_init('http://filepost.com/');
         $this->options[CURLOPT_HTTPHEADER] = array('Cookie: ' . implode('; ', $this->cookies));
         $response = parent::curly_get(array('' => ''), function () {
         });
         if (preg_match("/SID: '(?<sid>[a-f0-9]{32})'/", $response, $matches)) {
             $this->SID = isset($matches['sid']) ? $matches['sid'] : NULL;
         }
         if (preg_match("/upload_url: 'http:\\/\\/(?<upload_url>.*)',/", $response, $matches)) {
             $this->upload_url = isset($matches['upload_url']) ? 'http://' . $matches['upload_url'] : NULL;
         }
         if (!isset($this->upload_url, $this->SID)) {
             die('No active SID or URL returned.');
         }
         parent::curly_init($this->upload_url);
         $this->options[CURLOPT_HTTPHEADER] = array('Accept: text/*', 'User-Agent: Shockwave Flash', 'Connection: Keep-Alive', 'Cache-Control: no-cache');
         $response = parent::curly_post(array('Filename' => basename($this->filePath), 'SID' => $this->SID, 'file' => "@{$this->filePath};filename=" . basename($this->filePath), 'Upload' => 'Submit Query'), $callback);
         if (preg_match('/"answer":"(?<tmp_link>.*)"/', $response, $matches)) {
             $contents = file_get_contents('http://filepost.com/files/done/' . $matches['tmp_link']);
             if (preg_match('/id="down_link" class="inp_text" value="http:\\/\\/(?<dlink>.*)"\\/>/', $contents, $matches2)) {
                 echo 'http://' . $matches2['dlink'];
             }
         }
     }
 }
 /**
  * Filesonic::Upload()
  * 
  * @param callback $callback
  * @return (string) $Download_URL || (bool) FALSE
  */
 final function Upload($callback)
 {
     // Must authenticate and get Upload URI
     parent::curly_init($this->getUploadUrl());
     $response = json_decode(parent::curly_post(array('files[]' => "@{$this->filePath}"), $callback));
     return isset($response->FSApi_Upload->postFile->status) && $response->FSApi_Upload->postFile->status == 'success' ? $response->FSApi_Upload->postFile->response->files[0]->url : FALSE;
 }
 public function Upload($callback)
 {
     if ($this->Login()) {
         if (!isset($this->SID)) {
             die('Uploading.com - No session.');
         }
         // get upload url
         parent::curly_init('http://uploading.com/');
         $this->options[CURLOPT_HTTPHEADER] = array('Cookie: ' . implode('; ', $this->cookies));
         # must be set each time
         $response = parent::curly_get(array('' => ''), function () {
         });
         if (preg_match("/upload_url: 'http:\\/\\/(?<upload_url>.*)',/", $response, $matches)) {
             $this->upload_url = isset($matches['upload_url']) ? 'http://' . $matches['upload_url'] : NULL;
         }
         if (!isset($this->upload_url)) {
             die('No upload URL returned.');
         }
         // create file placeholder
         parent::curly_init('http://uploading.com/files/generate/?JsHttpRequest');
         $this->options[CURLOPT_HTTPHEADER] = array('Cookie: ' . implode('; ', $this->cookies));
         # must be set each time
         $json_obj = json_decode(parent::curly_post(array('name' => basename($this->filePath), 'size' => filesize($this->filePath)), function () {
         }));
         // this needs the post header custom created because of duplicate "file" fields
         parent::curly_init($this->upload_url);
         // additional headers required for upload
         $boundary = substr(strtr(base64_encode(md5(microtime(TRUE) . 'asdfasdf')), array('+' => '', '/' => '', '=' => '')), 0, 30);
         $this->options[CURLOPT_HTTPHEADER] = array('Accept: text/*', 'Content-Type: multipart/form-data; boundary=----------' . $boundary, 'User-Agent: Shockwave Flash', 'Connection: Keep-Alive', 'Cache-Control: no-cache');
         $headers = array('------------' . $boundary, 'Content-Disposition: form-data; name="Filename"', '', basename($this->filePath), '------------' . $boundary, 'Content-Disposition: form-data; name="folder_id"', '', '0', '------------' . $boundary, 'Content-Disposition: form-data; name="SID"', '', $this->SID, '------------' . $boundary, 'Content-Disposition: form-data; name="file"', '', $json_obj->file_id, '------------' . $boundary, 'Content-Disposition: form-data; name="file"; filename="' . basename($this->filePath) . '"', 'Content-Type: application/octet-stream', '', file_get_contents($this->filePath), '------------' . $boundary, 'Content-Disposition: form-data; name="Upload"', '', 'Submit Query', '------------' . $boundary . '--');
         return substr(parent::curly_post(implode("\r\n", $headers), $callback), 0, 3) == 'new' ? $json_obj->link : FALSE;
     }
 }
 public function Upload($callback)
 {
     $uploadID = number_format(microtime(TRUE), 0, '', '');
     file_get_contents('http://zeta.oron.com/status.html?file=' . $uploadID . '=' . basename($this->filePath));
     parent::curly_init('http://zeta.oron.com/upload/375/?X-Progress-ID=' . $uploadID);
     if (preg_match("/'fn' value='(.*)'><input/", parent::curly_post(array('upload_type' => 'file', 'srv_id' => '375', 'sess_id' => $this->sessionId, 'srv_tmp_url' => 'http://zeta.oron.com', 'file_0' => "@{$this->filePath};filename=" . basename($this->filePath), 'ut' => 'file', 'tos' => '1', 'submit_btn' => ' Upload!'), $callback), $matches)) {
         return 'http://oron.com/' . $matches[1];
     }
     return FALSE;
 }
 public function Upload($callback)
 {
     $tmp_cookie = NULL;
     $this->Login();
     if (!isset($this->cookie)) {
         die('Filefactory session could not be extracted.');
     }
     parent::curly_init('http://upload.filefactory.com/upload.php');
     $this->options[CURLOPT_HTTPHEADER] = array('Host: upload.filefactory.com', 'User-Agent: Shockwave Flash', 'Content-Type: multipart/form-data');
     $download_link = parent::curly_post(array('Filename' => basename($this->filePath), 'folderViewhash' => '0', 'cookie' => $this->cookie, 'Filedata' => "@{$this->filePath}", 'Upload' => 'Submit Query'), $callback);
     return 'http://www.filefactory.com/file/' . $download_link . '/n/' . basename($this->filePath);
 }
 public function Upload($callback)
 {
     $this->sessionId = substr(strtr(base64_encode(md5(microtime(TRUE))), array('+' => '', '/' => '', '=' => '')), 0, 16);
     // initiate session
     file_get_contents('http://2shared.com/uploadComplete.jsp?sId=' . $this->sessionId);
     parent::curly_init('http://dc187.2shared.com/main/upload2.jsp?sId=' . $this->sessionId);
     if (preg_match('/Your upload has successfully completed!/', parent::curly_post(array('fff' => "@{$this->filePath};filename=" . basename($this->filePath), 'mainDC' => '282'), $callback))) {
         /*
                 <textarea cols="20" rows="2" name="downloadLink" id="downloadLink" readonly="readonly" onclick="this.focus();this.select()" style="width:468px">http://www.2shared.com/document/H9ueae5_/test.html</textarea><br />
         */
         if (preg_match('/>http:\\/\\/www.2shared.com\\/(.*)<\\/textarea>/i', file_get_contents('http://2shared.com/uploadComplete.jsp?sId=' . $this->sessionId), $matches)) {
             return 'http://www.2shared.com/' . $matches[1];
         }
     }
     return FALSE;
 }
 /**
  * Fileserve::Upload()
  * 
  * @param callback $callback
  * @return string $download_url
  */
 public function Upload($callback)
 {
     // Get session upload id.
     if (preg_match("/sessionId:'([a-z0-9\\-]+)'/", file_get_contents('http://upload.fileserve.com/upload/15316968/5000/?callback=j&_=1326432820769'), $matches)) {
         $this->sessionId = $matches[1];
     }
     parent::curly_init('http://upload.fileserve.com/upload/15316968/5000/' . $this->sessionId . '/');
     if (preg_match('/"shortenCode":"(.*)"/i', parent::curly_post(array('file' => "@{$this->filePath};filename=" . basename($this->filePath)), $callback), $matches)) {
         return 'http://www.fileserve.com/file/' . $matches[1];
     }
     /* //obsolete
        return parent::curly_ftp(fopen($this->filePath, 'r'), filesize($this->filePath), function( $pct ){
            echo $pct, "%\r";
        });
        */
     return FALSE;
 }
 /**
  * Megaupload::Upload()
  * 
  * @param callback $callback
  * @return string $download_url
  */
 final function Upload($callback)
 {
     if (FALSE === $this->Login()) {
         #must authenticate to retrieve cookie!
         die('Megaupload: error authenticating.');
     }
     for ($i = 0; $i < 32; $i++, $this->upload_identifier .= mt_rand(0, 9)) {
     }
     parent::curly_init("http://www434.megaupload.com/upload_done.php?UPLOAD_IDENTIFIER={$this->upload_identifier}&user={$this->cookie}&s=" . filesize($this->filePath));
     $result = parent::curly_post(array('Filename' => basename($this->filePath), 'user' => $this->cookie, 'hotlink' => '0', 'Filedata' => "@{$this->filePath}", 'Upload' => 'Submit Query'), $callback);
     $lines = explode("\n", $result);
     foreach ($lines as $line) {
         $line = trim($line);
         if (preg_match("/parent.downloadurl = '(.*)'/", $line, $matches)) {
             return $matches[1];
         }
     }
     return FALSE;
 }
 public function Upload($callback)
 {
     // get upload stuff
     //<form target="uploadframe" id="upload_form"
     parent::curly_init('http://depositfiles.com/');
     $this->options[CURLOPT_HTTPHEADER] = array('Cookie: autologin='******'' => ''), function () {
     });
     if (preg_match('/<form target="uploadframe" id="upload_form" method="post" enctype="multipart\\/form-data" action="(?<upload_url>.*)\\/\\?X-Progress-ID=(.*)" onsubmit="return check_form\\(\\)">/', $response, $matches)) {
         $this->upload_url = isset($matches['upload_url']) ? $matches['upload_url'] . '/?X-Progress-ID=' . $this->upload_id : NULL;
     }
     if (!isset($this->upload_url, $this->upload_id)) {
         die('No upload URL or ID returned.');
     }
     parent::curly_init($this->upload_url);
     $this->options[CURLOPT_HTTPHEADER] = array('Cookie: autologin='******'Connection: keep-alive', 'Referer: http://depositfiles.com/');
     if (preg_match("/parent.ud_download_url = '(.*)';/", parent::curly_post(array('MAX_FILE_SIZE' => '2097152000', 'UPLOAD_IDENTIFIER' => $this->upload_id, 'go' => '1', 'files' => "@{$this->filePath};filename=" . basename($this->filePath), 'agree' => '1', 'padding' => '                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        '), $callback), $matches)) {
         return $matches[1];
     }
 }
 public function Upload($callback)
 {
     $this->Login();
     if (isset($this->cookie)) {
         parent::curly_init('http://filejungle.com');
         $this->options[CURLOPT_HTTPHEADER] = array('Cookie: PHPSESSID=' . $this->cookie);
         $response = parent::curly_get(array('' => ''), function () {
         });
         if (preg_match("/uploadUrl = 'http:\\/\\/(?<upload_url>.*)';/", $response, $matches)) {
             $this->upload_url = isset($matches['upload_url']) ? 'http://' . $matches['upload_url'] : NULL;
         }
         if (isset($this->upload_url)) {
             $filesize = filesize($this->filePath);
             parent::curly_init($this->upload_url);
             $this->options[CURLOPT_HTTPHEADER] = array('X-File-Name: ' . basename($this->filePath), 'X-File-Size: ' . $filesize, 'Content-Type: multipart/form-data', 'Origin: http://filejungle.com');
             $json_obj = @json_decode(parent::curly_put(fopen($this->filePath, 'r'), $filesize, $callback));
             if (isset($json_obj)) {
                 return 'http://www.filejungle.com/f/' . $json_obj->shortenCode;
             }
         }
     }
 }
 /**
  * Mediafire::Upload()
  * 
  * @param callback $callback
  * @return string $download_link
  */
 public function Upload($callback)
 {
     $this->Login();
     if (!isset($this->ukey, $this->skey, $this->session)) {
         die('Invalid mediafire session.');
     }
     // Upload and fetch tracker key
     parent::curly_init('http://www.mediafire.com/douploadtoapi/?type=basic&ukey=' . $this->ukey . '&user='******'&uploadkey=myfiles&filenum=0&uploader=0&MFULConfig=wxbp16ok9pzhorbna5rxf8bey6n8qxjx');
     $response = parent::curly_post(array('Filedata' => "@{$this->filePath};filename=" . basename($this->filePath)), $callback);
     if (preg_match('/<key>(.*)<\\/key>/', $response, $matches)) {
         while (TRUE) {
             parent::curly_init('http://www.mediafire.com/basicapi/pollupload.php');
             if (preg_match('/<quickkey>(.*)<\\/quickkey>/', parent::curly_get(array('key' => $matches[1]), function () {
             }), $matches2)) {
                 if ($matches2[1] != '') {
                     return 'http://www.mediafire.com/download.php?' . $matches2[1];
                 }
             }
         }
     }
     return FALSE;
 }