-1

I have an affiliate Bol account, and was fetching transaction report stats daily via login with script and importing results in my database.

Recently the login form changed and applied captcha.

I changed the snippet with sending CSRF token along with login details. It worked for a few days but now it has also stopped working.

Here are code details;

$url = "https://login.bol.com/login?client_id=apm";
$csrf_token_field_name = "csrftoken";
$params =   array(
            "j_username" => 'myusername',
            "j_password" => 'mypassword',
            "submit" => " Inloggen"
        );

$token_cookie= realpath("test.txt");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (X11; Linux x86_64) 
AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/32.0.1700.107 
Chrome/32.0.1700.107 Safari/537.36');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, $token_cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $token_cookie);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
if (curl_errno($ch)) die(curl_error($ch));
libxml_use_internal_errors(true);
$dom = new DomDocument();
$dom->loadHTML($response);
libxml_use_internal_errors(false);
$tokens = $dom->getElementsByTagName("input");
for ($i = 0; $i < $tokens->length; $i++) 
{
 $meta = $tokens->item($i);
 if($meta->getAttribute('name') == 'csrftoken')
    $t = $meta->getAttribute('value');
}

if($t) {
$csrf_token = file_get_contents(realpath("another-cookie.txt"));
// Setting up post information
$postinfo = "";
foreach($params as $param_key => $param_value) 
{
    $postinfo .= $param_key ."=". $param_value . "&";   
}
$postinfo .= $csrf_token_field_name ."=". $t;
curl_setopt($ch, CURLOPT_URL, 
"https://login.bol.com/j_spring_security_check");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows 
NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt($ch, CURLOPT_COOKIEJAR, $token_cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $token_cookie);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postinfo);
curl_setopt($ch, CURLOPT_REFERER, 
"https://partner.bol.com/partner/index.do");
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 260);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);

ob_start();
$html = curl_exec($ch);
$result = curl_getinfo($ch);
ob_get_clean();
}
Community
  • 1
  • 1
Zubair Ahmed
  • 44
  • 11

1 Answers1

0

Sharing below information so that it will help others facing same problem.

Solution: After contacting bol technical team, either we need our server from Nederland or set hardcode ip to Nederland that results captch to hide and continue with login form.

Regards, Zubair

Zubair Ahmed
  • 44
  • 11
  • I do have a Dutch IP, so that won't be the issue. But how do you use the script above to download the report from https://partner.bol.com/orders/v1/reports/orders/1234567?startDate=01-10-2021&endDate=01-01-2022 ?? – Ruud Kok Jan 24 '22 at 10:00