Untitled

mail@pastecode.io avatar
unknown
php
2 years ago
1.2 kB
2
Indexable
Never
<?php

$url = $_GET['url'];
$domain = parse_url($url)['host'];

$resp = bypass($url);

$cookie = $resp['solution']['cookies'];
$userAgent = $resp['solution']['userAgent'];

$solution = json_encode([
    "cookies" => $cookie,
    "userAgent" => $userAgent
]);

file_put_contents($solution_file, $solution);


// FUNCTION
function bypass($url)
{
    $api = "http://103.74.122.29:8191/v1";

    $curl = curl_init($api);
    curl_setopt($curl, CURLOPT_URL, $api);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

    $headers = array(
        "Content-Type: application/json",
    );
    curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);

    $data = json_encode([
        "cmd" => "request.get",
        "url" => $url,
        "maxTimeout" => 10000
    ]);

    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);

    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

    $resp = json_decode(curl_exec($curl), true);
    curl_close($curl);

    if($resp['status'] !== 'ok'){
        exit("Không thể bypass url này!");
    }

    return $resp;
}