function getCI($cedula, $return_raw = false) { $res = getCurlData("https://cuado.co:444/api/v1?app_id=" . APPID_CEDULA . "&token=" . TOKEN_CEDULA . "&cedula=" . (int) $cedula); if ($return_raw) { return strlen($res) > 3 ? $res : false; } $res = json_decode($res, true); return isset($res['data']) && $res['data'] ? $res['data'] : $res['error_str']; }
function isHuman($recaptcha) { $google_url = "https://www.google.com/recaptcha/api/siteverify"; $secret = '6LeHxwkTAAAAADhEFzPb8eF_XaF3VGoy6ZThtXWh'; $ip = $_SERVER['REMOTE_ADDR']; $url = $google_url . "?secret=" . $secret . "&response=" . $recaptcha . "&remoteip=" . $ip; $res = getCurlData($url); $res = json_decode($res, true); //reCaptcha success check if ($res['success']) { return TRUE; } else { return FALSE; } }
function pull_daily_reviews(){ global $wpdb; $date = date("y-m-d h:i:s"); /*Used to create log i.e. which page number of API should be initiated*/ $log_table = $wpdb->prefix . 'revinateLog'; $myrows = $wpdb->get_results( "SELECT * FROM ".$log_table ); $myrows = json_decode(json_encode($myrows), true); if($wpdb->num_rows > 0 ){ $pageNo =0; $arr = getCurlData($pageNo); $postTable = $wpdb->prefix . 'options'; $myrows = $wpdb->get_results( "SELECT * FROM ".$postTable ."where" ); $myrows = json_decode(json_encode($myrows), true); if(isset($arr['content'])){##############incase content is there $content = $arr['content']; $totalPage = $arr['page']['totalPages']; $sql = $wpdb->query("UPDATE $log_table SET page_no ='".$pageNo."', success = 1,total_page = '".$totalPage."',pointer = 1,date = '".$date."'"); insertReviews($content,$pageNo,$arr['page']['totalPages'],1);/*Insert Review*/ //calcuateaverage(); } else{ //echo "API Acces Denied.User credentials do not have access to large page size"; return; } } }
<script src="js/template.js"></script> <script src='https://www.google.com/recaptcha/api.js'></script> </body> </html> <?php include "connect.php"; $name = $_POST['useremail']; $recaptcha = $_POST['g-recaptcha-response']; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (!empty($recaptcha)) { include "getCurlData.php"; $google_url = "https://www.google.com/recaptcha/api/siteverify"; $secret = '6LfqogYTAAAAAHiKKzw4LZm5kYZ-uYVY4V_HiMfT'; $ip = $_SERVER['REMOTE_ADDR']; $url = $google_url . "?secret=" . $secret . "&response=" . $recaptcha . "&remoteip=" . $ip; $res = getCurlData($url); $res = json_decode($res, true); if ($res['success']) { $sql = "SELECT * FROM employeelogin WHERE email='{$name}'"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_array($result)) { $pass = $row['password']; include "innerpage/classes/class.phpmailer.php"; $mail = new PHPMailer(); //$mail->SMTPDebug = 3; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'localhost'; // Specify main and backup SMTP servers $mail->SMTPAuth = true;
function getRifSeniat($rif, $return_result = false) { $rif = strtoupper(preg_replace("/[ ,_-]+/", "", $rif)); try { $rawXml = getCurlData('http://contribuyente.seniat.gob.ve/getContribuyente/getrif?rif=' . $rif); if ($rawXml) { $rawXml = preg_replace("/<rif:Rif[^>]+>/i", "<rif>", $rawXml); $rawXml = preg_replace("/rif:/i", "", $rawXml); $rawXml = preg_replace("/<\\/Rif>/i", "</rif>", $rawXml); $xml = @simplexml_load_string($rawXml); if ($xml) { $result = array("rif" => $rif, "name" => trim(preg_replace("/\\([^\\)]*\\)/", "", (string) $xml->{"Nombre"})), "agente_retencion" => (string) $xml->{"AgenteRetencionIVA"} == "SI", "contribuyente_iva" => (string) $xml->{"ContribuyenteIVA"} == "SI", "contribuyente_tasa" => floatval((string) $xml->{"Tasa"})); $result_rif = array("ok" => true, "result" => $result); } else { $result_rif = array("ok" => false, "error" => htmlentities($rawXml)); } } else { $result_rif = array("ok" => false, "error" => htmlentities(lang("sales_remote_access_failed2"))); } } catch (Exception $e) { $result_rif = array("ok" => false, "error" => htmlentities(lang("sales_remote_access_failed"))); } if ($return_result) { return $result_rif; } else { echo $result_rif; } }
<?php if (Tools::isSubmit('importFeedback')) { //1.通过curl获取反馈数据. $ids = Tools::getRequest('ali_productid'); $aliids = explode(",", $ids); $feedbacks = array(); foreach ($aliids as $id) { $src = "http://www.aliexpress.com/cross-domain/detailevaluationproduct/index.html?productId=" . $id . "&type=default&page=1"; $data = getCurlData($src); $feedbacks = array_merge($data->records, $feedbacks); if ($data->page->total > 1) { for ($i = 2; $i <= $data->page->total; $i++) { $src = "http://www.aliexpress.com/cross-domain/detailevaluationproduct/index.html?productId=" . $id . "&type=default&page=" . $i; $pagedata = getCurlData($src); if (is_array($pagedata->records)) { $feedbacks = array_merge($pagedata->records, $feedbacks); } } } } //2.第二阶段,剔除为空的数据,并将不为空的数据加入到产品中. $rating_fields = array("one_star", "two_star", "three_star", "four_star", "five_star"); $products = Db::getInstance()->ExecuteS('SELECT `id_product`,`price` FROM ' . _DB_PREFIX_ . 'product ORDER BY orders ASC LIMIT 0,200'); $productids = array(); foreach ($products as $row) { $productids[$row["id_product"]] = $row["price"]; } foreach ($feedbacks as $feed) { if (strlen($feed->buyerFeedback) == 0 || $feed->star < 3) { continue;
public function contact() { if ($this->request->is('get')) { if ($this->getConfig['ajaxTemplate']) { if (!$this->request->is('ajax')) { throw new MethodNotAllowedException(__('No puedes acceder de esta forma!')); } $this->layout = 'ajax'; } $contact['latitude'] = '42.28185'; $contact['longitude'] = '-8.60917'; $this->set('contact', $contact); } elseif ($this->request->is('post')) { $recaptcha = $this->data['g-recaptcha-response']; $google_url = "https://www.google.com/recaptcha/api/siteverify"; $secret = '6LdgtvwSAAAAANRtPnE_5SIB73I8TGTwtyJgzDJL'; $ip = $_SERVER['REMOTE_ADDR']; $url = $google_url . "?secret=" . $secret . "&response=" . $recaptcha . "&remoteip=" . $ip; App::import('Vendor', 'recaptcha/curl'); $res = getCurlData($url); $res = json_decode($res, true); if (empty($res['success']) && $res['success'] == true) { try { $this->Emails->contact($this->request->data['contact']); $this->Session->setFlash(__('Tu mensaje se ha enviado correctamente.'), 'flashMessages/success'); $this->redirect(array('controller' => 'pages', 'action' => 'index')); } catch (Exception $e) { $this->Session->setFlash(__('Ha habido un error al enviar tu mensaje, prueba de nuevo.'), 'flashMessages/error'); } } else { $this->Session->setFlash(__('El captcha detectó un error, vuelve a intentarlo.'), 'flashMessages/error'); } } }
return round($data[0], 2); } function getUserIP() { $client = @$_SERVER['HTTP_CLIENT_IP']; $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; $remote = $_SERVER['REMOTE_ADDR']; if (filter_var($client, FILTER_VALIDATE_IP)) { $ip = $client; } elseif (filter_var($forward, FILTER_VALIDATE_IP)) { $ip = $forward; } else { $ip = $remote; } return $ip; } function getCurlData($url) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_TIMEOUT, 10); curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16"); $curlData = curl_exec($curl); curl_close($curl); return $curlData; } $userip = getUserIP(); $lookup = getCurlData("http://geoip.redstoneapi.com/json/{$userip}"); $obj = json_decode($lookup); $location = $obj->country_code;