Jump to content

nguyenlinh

Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. Mình cũng code với php mà ko chạy các bạn xem giúp mình với <?php // Submit those variables to the server $chucai = "ABCDEFGHIJKLMNOPQresponseTUVWXYZ0123456789"; function generate_string( $input, $strength = 16 ) { $input_length = strlen( $input ); $random_string = ''; for ( $i = 0; $i < $strength; $i ++ ) { $random_character = $input[ mt_rand( 0, $input_length - 1 ) ]; $random_string .= $random_character; } return $random_string; } $csrftoken = generate_string( $chucai, 32 ); $post_data = array( 'login_key' => 'user', 'login_type' => 'username', 'password_hash' => 'password_hash', 'captcha' => '', 'remember_me' => false, 'redirect' => 'https://shopee.vn/buyer/', ); $headers = array( 'Content-Type: multipart/form-data', ':authority: shopee.vn', ':method: POST', ':path: /api/v0/buyer/login/login_post/', ':scheme: https', 'accept: */*', 'accept-encoding: gzip, deflate, br', 'accept-language: en-US,en;q=0.9,vi;q=0.8,es;q=0.7,fr;q=0.6,it;q=0.5,ro;q=0.4', 'content-length: 613', 'content-type: multipart/form-data; boundary=----WebKitFormBoundaryGn3L3nbSS9Odqlw7', 'origin: https://shopee.vn', 'referer: https://shopee.vn/', 'sec-fetch-mode: cors', 'sec-fetch-site: same-origin', 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36', 'x-api-source: pc', 'x-csrftoken: '. $csrftoken, 'x-requested-with: XMLHttpRequest', ); _curl( array( 'base_uri' => 'https://shopee.vn/api/v0/buyer/login/login_post/', 'body' => $post_data, 'headers' => $headers, 'method' => 'post', 'cookie' => "cookie.txt", 'csrftoken' => $csrftoken, 'referer' => 'https://shopee.vn/api/v0/buyer/login' ) ); function _curl( $params ) { $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, "https://shopee.vn/api/v0/buyer/login" ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $ch, CURLOPT_COOKIEJAR, $params['cookie'] ); curl_setopt( $ch, CURLOPT_COOKIEFILE, $params['cookie'] ); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'csrftoken: '. $params['csrftoken'], ) ); curl_setopt( $ch, CURLOPT_POST, 0 ); curl_exec( $ch ); curl_close( $ch ); $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, $params['base_uri'] ); curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 2 ); curl_setopt( $ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" ); curl_setopt( $ch, CURLOPT_TIMEOUT, 60 ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 0 ); curl_setopt( $ch, CURLOPT_COOKIEJAR, $params['cookie'] ); curl_setopt( $ch, CURLOPT_COOKIEFILE, $params['cookie'] ); curl_setopt($ch, CURLOPT_HTTPHEADER, $params['headers'] ); curl_setopt( $ch, CURLOPT_REFERER, $params['referer'] ); curl_setopt($ch, CURLOPT_ENCODING, 'UTF-8'); curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query( $params['body'] ) ); if ( 'post' == $params['method'] ) { curl_setopt( $ch, CURLOPT_POST, 1 ); } $result = curl_exec( $ch ); curl_close( $ch ); var_dump( $result ); }
×
×
  • Create New...