public function get_link() { // Check Captcha $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6LfXLBwTAAAAAKog-gWVMOmDJKhHGEMCELdR-Ukn&response=" . Input::get('g-recaptcha-response')); $obj = json_decode($response); if ($obj->success == false) { echo 'Captcha error'; exit; } else { libxml_use_internal_errors(true); require_once app_path('Libraries/Curl.php'); $url = Input::get('url'); $url = str_replace("http://", "https://", $url); // step 1: Login $curl = new \Curl(); $curl->get('https://www.fshare.vn'); $session_id = $curl->getCookie('session_id'); $doc = new \DOMDocument(); $doc->loadHTML($curl->response); $xpath = new \DOMXpath($doc); $array = $xpath->query("//*[@id='login-form']//*[@name='fs_csrf']"); foreach ($array as $value) { $fs_csrf = $value->getAttribute('value'); } $curl->setCookie('session_id', $session_id); $curl->post('https://www.fshare.vn/login', array("fs_csrf" => $fs_csrf, "LoginForm[email]" => "*****@*****.**", "LoginForm[password]" => "7508286", "LoginForm[rememberMe]" => "0", "yt0" => "Đăng nhập")); $session_id = $curl->getCookie('session_id'); $curl->setCookie('session_id', $session_id); $curl->post('https://www.fshare.vn/login', array("fs_csrf" => $fs_csrf, "LoginForm[email]" => "*****@*****.**", "LoginForm[password]" => "7508286", "LoginForm[rememberMe]" => "0", "yt0" => "Đăng nhập")); echo "Step 1: Login - Done !!! <br>"; // step 2: Get link download $curl->get($url); $doc = new \DOMDocument(); $doc->loadHTML($curl->response); $xpath = new \DOMXpath($doc); $array = $xpath->query("//*[@id='download-form']/div[1]/input"); foreach ($array as $value) { $fs_csrf = $value->getAttribute('value'); } $split_url = explode('/', $url); $curl->post('https://www.fshare.vn/download/get', array("fs_csrf" => $fs_csrf, "DownloadForm[pwd]" => "", "DownloadForm[linkcode]" => end($split_url), "ajax" => "download-form", "undefined" => "undefined")); echo "Step 2: Get Link Download - Done !!! <br><br>"; echo "URL: " . @$curl->response->url; return redirect()->away($curl->response->url); } // END IF CHECK RECAPTCHA }
<?php require 'Curl.php'; // step 1 $curl = new Curl(); $curl->get('https://www.fshare.vn'); $session_id = $curl->getCookie('session_id'); $doc = new DOMDocument(); $doc->loadHTML($curl->response); $xpath = new DOMXpath($doc); $array = $xpath->query("//*[@id='login-form']//*[@name='fs_csrf']"); foreach ($array as $v) { $fs_csrf = $v->getAttribute('value'); } // step 2 $curl->setCookie('session_id', $session_id); $curl->post('https://www.fshare.vn/login', array("fs_csrf" => $fs_csrf, "LoginForm[email]" => "*****@*****.**", "LoginForm[password]" => "7508286", "LoginForm[rememberMe]" => "0", "yt0" => "Đăng nhập")); $session_id = $curl->getCookie('session_id'); // step 3 $curl->setCookie('session_id', $session_id); $curl->post('https://www.fshare.vn/login', array("fs_csrf" => $fs_csrf, "LoginForm[email]" => "*****@*****.**", "LoginForm[password]" => "7508286", "LoginForm[rememberMe]" => "0", "yt0" => "Đăng nhập")); $curl->get('https://www.fshare.vn/account/profile'); $doc = new DOMDocument(); $doc->loadHTML($curl->response); $xpath = new DOMXpath($doc); $array = $xpath->query("//*[@id='ProfileForm_name']"); foreach ($array as $v) { $test = $v->getAttribute('value'); }