E
E
evyqs2020-04-22 14:16:18
PHP
evyqs, 2020-04-22 14:16:18

How to log in to the site (cURL)?

There is a site bosslike.ru on which you need to pass authorization. I'm trying to do this with curl on the page bosslike.ru/login but it doesn't work for me (I'm just learning, so don't hit me hard).

* - my data

<?php
$ch = curl_init();
$url = 'https://bosslike.ru/login/';
$param = [
    'UserLogin' => [
        'login' => ' * ',
        'password' => ' * ',
        'g-recaptcha-response' => ' * ',
        'submitLogin' => 'Войти',
        ]
    ];
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER , true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($param));
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0');

curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__). 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__). 'cookie.txt');

$content = curl_exec($ch);
curl_close($ch);
echo $content;
?>


Tell me how to make it pass authorization or if possible write the code, I will be very grateful.
PS at the entrance except login:password is recaptcha

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2020-04-22
@FanatPHP

site:qna.habr.com How to authorize on cURL site 23000 results

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question