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) { $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']; } } } }
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; }