Created
August 27, 2013 07:13
-
-
Save holyketzer/6350540 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl_setopt($ch, CURLOPT_URL, $captcha[0]); // Pass URL as parameter. | |
// тут не знаю как правильно заполнить и всё ли нужно | |
curl_setopt($ch, CURLOPT_USERAGENT, $agents); | |
curl_setopt($ch, CURLOPT_COOKIESESSION, true); | |
curl_setopt($ch, CURLOPT_COOKIE, $cookie); | |
curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE); | |
curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE); | |
// вот это я так понял обязательно, результат + в двоичном виде | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Return stream contents. | |
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); // We'll be returning this | |
// качаем капчу | |
$data = curl_exec($ch); // // Grab the jpg and save the contents in the | |
// придумываем имя для файла куда её сохранить | |
$captcha_tmpfile = './captcha/captcha-' . rand(1000, 10000) . '.jpg'; | |
// Сохраняем | |
$fp = fopen($tmpdir . $captcha_tmpfile, 'w'); | |
fwrite($fp, $data); | |
fclose($fp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment