$proxyRequestUrl = "https://{$destinationHostAddress}{$_SERVER['REQUEST_URI']}"
. (empty($urlData['query']) ? '' : "?{$urlData['query']}");
$ch = curl_init();
$proxies = [
'104.248.63.18:30588', '162.243.175.93:1080' // и т.д.
];
shuffle($proxies);
$torSocks5Proxy = $proxies[0];
// curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
// curl_setopt($ch, CURLOPT_PROXY, $torSocks5Proxy);
$inputJSON = file_get_contents('php://input');
// var_dump($inputJSON);die;
if (sizeof($_POST) > 0) {
$destinationRequestHeaders[] = 'X-Requested-With: XMLHttpRequest';
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($_POST));
curl_setopt($ch, CURLOPT_POST, 1);
}
//var_dump($destinationRequestHeaders);
//die;
curl_setopt($ch, CURLOPT_URL, $proxyRequestUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if ($_SERVER['REQUEST_URI'] !== '/graphql') {
curl_setopt($ch, CURLOPT_HEADER, 1);
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $destinationRequestHeaders);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_COOKIEJAR, __DIR__ . '/cookies/cookie' . $sessionId . '.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, __DIR__ . '/cookies/cookie' . $sessionId . '.txt');
curl_setopt($ch, CURLOPT_STDERR, fopen('php://output', 'w'));