Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class yandexCaptcha {
- public $key;
- public function __construct($key) {
- $this->key = $key;
- }
- public function get() {
- $type = "std";
- $xmlResponse = file_get_contents("http://cleanweb-api.yandex.ru/1.0/get-captcha?key=".$this->key."&type=".$type);
- $xml = simplexml_load_string($xmlResponse);
- return array('url' => $xml->url, 'code' => $xml->captcha);
- }
- public function send($captchaCode, $captchaValue) {
- $xmlResponse = file_get_contents("http://cleanweb-api.yandex.ru/1.0/check-captcha?key=".$this->key."&captcha=".$captchaCode."&value=".$captchaValue);
- $xml = new SimpleXMLElement ($xmlResponse);
- $result = $xml->children();
- return $result->getName();
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment