Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ch = curl_init();
- // Not sure that I need it, just make sure that the session doesn't change...
- curl_setopt($ch, CURLOPT_COOKIESESSION, false);
- curl_setopt($ch, CURLOPT_URL, $loginUrl);
- // It seems that PHPSESSID cookie parameter might be the parameter that keep the image the same, but it didn't work. I even read it dynamically from the cookie file but it still didn't work
- //curl_setopt($ch, CURLOPT_COOKIE, "PHPSESSID=2bp3nhkp3bgftfrr1rjekg03o2");
- curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieName);
- curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieName);
- curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_REFERER, $loginUrl);
- $result = curl_exec($ch);
- // Resolve the captcha and append it to the post parameters
- $captchaText = $this->resolveCaptcha($result);
- $postData .= '&LoginForm%5BverifyCode%5D='.$captchaText;
- // Resubmit the form with the updated form data
- curl_setopt($ch, CURLOPT_REFERER, $loginUrl);
- curl_setopt($ch, CURLOPT_URL, $loginUrl);
- curl_setopt ($ch, CURLOPT_POST, 1); //FIXED
- curl_setopt ($ch, CURLOPT_POSTFIELDS, $postData);
- $result = curl_exec($ch);
Add Comment
Please, Sign In to add comment