lib/SolveRecaptcha.php:
<?php /* File: SolveRecaptcha.php Date: 16/01/2018 Version 1.0 Author: Glenn Prialde Copyright Solve Recaptcha http://www.solverecaptcha.com 2018. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * You must provide a link back to http://www.solverecaptcha.com on the site on which this software is used. * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the HenryRanch LCC nor the names of its contributors nor authors may be used to endorse or promote products derived from this software without specific prior written permission. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, OWNERS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ class SolveRecaptcha { private $host = 'api.solverecaptcha.com'; private $uid = null; private $key = null; private $port = 80; private $remoteFile = "/index.php"; private $basicAuthUsernameColonPassword = ""; private $bufferSize = 2048; private $mode = "get"; private $fromEmail = "admin@solverecaptcha.com"; private $postData = ""; private $localFile = ""; private $proxy_host = ""; private $proxy_port = ""; private $is_proxy = 0; public function __construct($uid, $key) { $this->uid = $uid; $this->key = $key; } public function solve($google_site_key, $page_url) { $url = 'http://api.solverecaptcha.com/index.php?sitekey=' . $google_site_key . '&pageurl=' . urlencode($page_url) . '&key=' . $this->key . '&user_id=' . $this->uid; if ($this->is_proxy == 1) { $ret = $this->_get_request($url, $this->proxy_host, $this->proxy_port); } else { $ret = $this->_get_request($url, null, null); } return $ret; } public function set_proxy($host, $port) { $this->proxy_host = $host; $this->proxy_port = $port; $this->is_proxy = 1; } private function _get_request($url, $proxy_host = null, $proxy_port = null) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1a2pre) Gecko/2008073000 Shredder/3.0a2pre ThunderBrowse/3.2.1.8"); curl_setopt($ch, CURLOPT_POST, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60); curl_setopt($ch, CURLOPT_TIMEOUT, 60); curl_setopt($ch, CURLOPT_TCP_NODELAY, TRUE); if ($proxy_host != null && $proxy_port != null) { $proxy = $proxy_host . ":" . $proxy_port; curl_setopt($ch, CURLOPT_PROXY, $proxy); } $response = curl_exec($ch); curl_close($ch); return $response; } } ?> example:
<?php include ('lib/SolveRecaptcha.php'); $key = "[<YOUR API KEY]"; // Get your own key at http://www.solverecaptcha.com/amember/signup $uid = "[<YOUR USER_ID]"; // Get your own user_id at http://www.solverecaptcha.com/amember/signup $api = new SolveRecaptcha($uid, $key); // Solve Google's reCAPTCHA version 2 print $api->solve('6LcT6wATAAAAAMBYUbtdHChwcLt3kaoBpvICxdDj', 'https://www.isnare.com/login.php'); ?>