Answer the question
In order to leave comments, you need to log in
How to log in to the site using curl, if there is a google captcha?
Good afternoon, do you need to log in to the supplier's website to parse goods? I send a post request with 3 parameters, I get the answer confirm that you are not a bot.
require 'vendor/autoload.php';
function request($url, $postdata = null, $cookiefile='cookie.txt')
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0');
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
if($postdata){
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
}
$html=curl_exec($ch);
curl_close($ch);
return $html;
}
file_put_contents('cookie.txt','');
$post="
'email'=>'********',
'password'='******',
'g-recaptcha-response'=>'';
$mas=request( ' https://opt.brain.com.ua/dealer/login ',$post);
echo $mas;
}
How can I get the captcha that the user drove it?
Answer the question
In order to leave comments, you need to log in
I use the resource "Anticaptcha" (paid, but inexpensive). There, ready-made php classes are provided for connection.
Log in through the browser, then use the cookies received in the parser.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question