0

I need your help. When I open this page in browser https://www.g2a.com/toolbar/toolbar?isAjax=ajax I open inspector and between tags i find key:123456 And if I reload page, the key:is kept 123456

But when i used curl, I always get different keys -123478, 84561a...

I need to simulate browser using php and curl

my code

$loginurl = 'https://www.g2a.com/toolbar/toolbar?isAjax=ajax';
$useragent = "Fake Mozilla 5.0 ";
$cookie_jar = tempnam("tmp", "g2a");

curl_setopt($ch, CURLOPT_URL, $loginurl);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_jar);
curl_setopt($ch, CURLOPT_COOKIEFILE,$cookie_jar);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

$result = curl_exec($ch);
$redir = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
curl_close($ch);


echo $result;

Thanks!

2
  • Did you look in the $cookie_jar file to see if anything actually got saved (or if the file was even created?)
    – Marc B
    Jul 17, 2014 at 14:29
  • files are created and information wrote
    – bigijoys
    Jul 17, 2014 at 14:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.