V
V
Vlad Nesterenko2017-11-17 11:29:46
PHP
Vlad Nesterenko, 2017-11-17 11:29:46

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

4 answer(s)
A
Alexey, 2017-11-17
@AlexMaxTM

I use the resource "Anticaptcha" (paid, but inexpensive). There, ready-made php classes are provided for connection.

D
DrunkMaster, 2017-11-17
@DrunkMaster

No PHP, it's in JS. That's the point.)

4
4iloveg, 2017-11-17
@4iloveg

Log in through the browser, then use the cookies received in the parser.

V
Vlad Nesterenko, 2017-11-17
@Vlad852

so is it possible to get cookies from another domain in php?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question