How to make a grabber with php and cURL with the authorization?

<?php
$url = 'https://allplay.uz/login'; //login on this link
$ch = curl_init();
$header = array
(
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language: ru-ru,ru;q=0.8,en-US;q=0.5,en;q=0.3',
'Accept-Encoding: gzip, deflate', // ukazyvaet the server response need to compress
'Content-type: application/x-www-form-urlencoded'
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_URL, $url); // send to
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0");
curl_setopt($ch, CURLOPT_HEADER, 0); // not include headlines in the query result
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // follow redirects
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);// таймаут4
curl_setopt($ch, THIS, false);// just disable certificate validation 
curl_setopt($ch, CURLOPT_REFERER, "https://allplay.uz/login");
curl_setopt($ch, THIS, false);// just disable certificate validation
curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).'/my_cookies.txt'); // save cookies to a file
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'/my_cookies.txt');
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate'); // curl ukazyvaet that the answer can be reduced, without this would be "gibberish"
curl_setopt($ch, CURLOPT_POST, 1); // use the data in post
$login = array(
'email' =--> 'почта@gmail.com',
'password' => 'password',
'x' => 0,
'y' => 0);
curl_setopt(($ch), CURLOPT_POSTFIELDS, http_build_query($login)); // for your form be so
curl_exec($ch);
if (curl_errno($ch))
{
print curl_error($ch);
exit;
}
curl_close($ch);
?>


results:

Whoops, looks like something went wrong.
August 19th 19 at 23:16
2 answers
August 19th 19 at 23:18
curl_setopt(($ch), CURLOPT_POSTFIELDS
Braces?

You forgot _token field and remember out of shape.
I do not understand? - Alford.Mohr commented on August 19th 19 at 23:21
in the field in addition to fields username and password are present in the same field _token and remember. Let's see what the request is sent to Web Inspector'E.
Brackets are extra. - Vern.Vandervort13 commented on August 19th 19 at 23:24
: authorization token turned remember put but however link to the video (a TV channel) is not true 403 error authorization not helping am I missing something? - Alford.Mohr commented on August 19th 19 at 23:27
: see the scripts and their logic, in this moment, necessity is the mother of invention, maybe some kind of cook be placed after the load and ajax request, maybe even an iframe. There is only a clairvoyant can help. - Vern.Vandervort13 commented on August 19th 19 at 23:30
August 19th 19 at 23:20
please wait code

Find more questions by tags HTTP CookiesPHPWeb Development