function verify($remote_ip, $private_key, $challenge, $response) { $url = "http://api-verify.recaptcha.net/verify"; $data = array( 'remoteip' => $remote_ip, 'privatekey' => $private_key, 'challenge' => $challenge, 'response' => $response, ); $response = RivetyCore_Url::get($url, $data); if ($response['http_code'] == 200) { $rc_response = explode(chr(10), $response['output'], 2); if ($rc_response[0] == "true") { $verify = true; } else { $verify = false; } } else { $verify = false; } return $verify; }
function go($action, $params, $url = null) { $params['Action'] = $action; if(!$url) $url = $this->_server; $params['AWSAccessKeyId'] = $this->_key; $params['SignatureVersion'] = 1; $params['Timestamp'] = gmdate("Y-m-d\TH:i:s\Z"); $params['Version'] = "2008-01-01"; uksort($params, "strnatcasecmp"); $toSign = ""; foreach($params as $key => $val){ $toSign .= $key . $val; } $sha1 = $this->hasher($toSign); $sig = $this->base64($sha1); $params['Signature'] = $sig; RivetyCore_Log::report('sqs go params',$params,Zend_Log::INFO); $output = RivetyCore_Url::get ($url,$params); $xmlstr =$output['output']; RivetyCore_Log::report("output from sqs", $output,Zend_Log::DEBUG); try{ $xml = new SimpleXMLElement($xmlstr); if($output['http_code'] == 200 and !isset($xml->Errors)){ RivetyCore_Log::report("xml from sqs", $xml,Zend_Log::DEBUG); return $xml; } else { return false; } } catch(Exception $ex) { return false; } }