Требуется отправить запрос вот с таким заголовком:
POST /check HTTP/1.1
Host: site.ru
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3
Referer: https://site.ru/index
Content-Type: application/x-www-form-urlencoded
X-Requested-With: XMLHttpRequest
Cookie: user_id_and_social_network_id=453906668__1; secret_key=3bb6f42c84fc4925d2876a05e86a467c; _ga=GA1.2.1061450566.1509956457; _gid=GA1.2.1473510227.1509956457; public_cookie=1afb8c9aceea43d34ec7c41ace5c1f16; like_public_time=1509958158; ci_session=a%3A4%3A%7Bs%3A10%3A%22session_id%22%3Bs%3A32%3A%2281efd436629782e0edc4f7c7014abb65%22%3Bs%3A10%3A%22ip_address%22%3Bs%3A15%3A%22213.135.113.197%22%3Bs%3A10%3A%22user_agent%22%3Bs%3A77%3A%22Mozilla%2F5.0+%28Windows+NT+6.1%3B+Win64%3B+x64%3B+rv%3A56.0%29+Gecko%2F20100101+Firefox%2F56.0%22%3Bs%3A13%3A%22last_activity%22%3Bi%3A1509990989%3B%7Dcf10c27fa191e4b31adaa210c056b8b9
Connection: keep-alive
Accept-Encoding: gzip, deflate
Content-Length: 17
отправляю запросы пока так
function post($url = null, $params = null)
{
// Инициализация соединения
$ch = curl_init();
curl_setopt_array(
$ch,
[
CURLOPT_URL => $url,
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0',
CURLOPT_HEADER => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_COOKIEJAR => 'cookies.data',
CURLOPT_COOKIEFILE => 'cookies.data',
]
);
if (isset($params)) {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params['params']);
}
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
А как передать все чтобы сайт не заметил подмены?