Advertising
Paste Description for getCaptchaGoogleAudio.php
This php script gets 1000 CAPTCHA audio files from Google's Audio CAPTCHA system and saves them to the subfolder /googleaudio/. This is meant to get a sampling size for testing your CAPTCHA breaking algorithms.
- getCaptchaGoogleAudio.php
- Wednesday, March 12th, 2008 at 7:30:57am MDT
- <?php
- //This script pulls CAPTCHAs URL from $urlGoogleAudio, then gets the CAPTCHA and saves them to folder $saveGoogleAudio from the range $startSound to $endSound.
- $urlGoogleAudio = "https://www.google.com/accounts/NewAccount?service=mail&continue=http%3A%2F%2Fmail.google.com%2Fmail%2Fe-11-10ba05aeaa8e9b701e5151437f9a44d3-64aeae753cc34f1c864f7edc97a046ccdc96987b&type=2";
- $saveGoogleAudio = "googleaudio/";
- $startSound = 0;
- $endSound = 999;
- //Make carraige returns appear correctly in all browsers. (ideally)
- echo "<PRE>";
- //These two lines force the output to be constantly flushed and updated for the user. (ideally)
- echo "Script Started.\n";
- //Pull in the CAPTCHA image as a string with cURL, and save to a file. The curl extension must first be enabled in php.ini.
- for ($i=$startSound;$i<=$endSound;$i++) {
- //First extract a unique URL for each CAPTCHA from the $urlGoogleAudio.
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $urlGoogleAudio."&rand=".$i);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- //If you're having difficulties with SSL, this may need to be enabled.
- //curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- $result = curl_exec($ch);
- //Enable this if you're having difficulties.
- //echo "Error is: ".curl_error($ch);
- curl_close($ch);
- //Parse out the URL, and retrieve the CAPTCHA for it.
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- //If you're having difficulties with SSL, this may need to be enabled.
- //curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- $sound = curl_exec($ch);
- //Enable this if you're having difficulties.
- //echo "Error is: ".curl_error($ch);
- curl_close($ch);
- //Save CAPTCHA to a file with the same name as $i.
- }
- else $i--;
- //Don't allow it to timeout.
- //Output occasional progress.
- if ($i%10 == 0) {
- }
- }
- echo "Script Complete.";
- //-maluc
- ?>
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.