Guest User

Untitled

a guest
May 4th, 2015
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <?php
  2. class yandexCaptcha {
  3. public $key;
  4.  
  5. public function __construct($key) {
  6. $this->key = $key;
  7. }
  8. public function get() {
  9. $type = "std";
  10. $xmlResponse = file_get_contents("http://c...content-available-to-author-only...x.ru/1.0/get-captcha?key=".$this->key."&type=".$type);
  11. $xml = simplexml_load_string($xmlResponse);
  12. // $url = $xml->url;
  13. // $code = $xml->captcha;
  14. return array('url' => $xml->url, 'code' => $xml->captcha);
  15. // return array('url' => $url, 'code' => $code);
  16. // $array=json_decode(json_encode(simplexml_load_string($xmlResponse)),true);
  17. return $array;
  18. }
  19. public function send($captchaCode, $captchaValue) {
  20. $xmlResponse = file_get_contents("http://c...content-available-to-author-only...x.ru/1.0/check-captcha?key=".$this->key."&captcha=".$captchaCode."&value=".$captchaValue);
  21. $xml = new SimpleXMLElement ($xmlResponse);
  22. $result = $xml->children();
  23. return $result->getName();
  24. }
  25. }
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment