Server IP : 51.89.169.208 / Your IP : 3.148.107.92 Web Server : Apache System : Linux ns3209505.ip-198-244-202.eu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Tue Nov 5 04:50:16 EST 2024 x86_64 User : yellowleaf ( 1019) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/yellowleaf/public_html/include-functions/ |
Upload File : |
<?php $path = $_SERVER['DOCUMENT_ROOT']; include_once $path."/connect_db.php"; function curl_get($url){ // create curl resource $ch = curl_init(); // set url curl_setopt($ch, CURLOPT_URL, $url); //return the transfer as a string curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // $output contains the output string $output = curl_exec($ch); // close curl resource to free up system resources curl_close($ch); return $output; } if ($_GET["keyword"] != "") { $keyword = addslashes($_GET["keyword"]); $res = $connect->query("SELECT * FROM `search_letters` WHERE `keyword` = '".$keyword."'"); if ($res->num_rows < 1) { $search_val = $keyword." near me"; $search_val = str_replace(" ", "+", $search_val); $search_url = "https://suggestqueries.google.com/complete/search?client=firefox&q=".$search_val; $val = file_get_contents($search_url); $json_decode = json_decode($val); $suggestions = $json_decode[1]; $result_suggestions = []; for ($i=0; $i < count($suggestions); $i++) { $explode = explode(" ", $suggestions[$i]); $l1 = $explode[count($explode) - 2]; $l2 = $explode[count($explode) - 1]; if ($l1 == "near" && $l2 == "me") { array_push($result_suggestions, $suggestions[$i]); } } for ($i=0; $i < count($result_suggestions); $i++) { $kv = addslashes(trim($result_suggestions[$i])); $connect->query("INSERT INTO `google_suggest` SET `keyword` = '$kv', `pop` = 0 ON DUPLICATE KEY UPDATE `pop` = `pop`+1") || die("Google suggest insert error"); } $insert = $connect->query("INSERT IGNORE INTO `search_letters` SET `keyword` = '".$keyword."'"); if (!$insert) { echo "Failed to insert"; }else{ echo "Insert success"; } }else{ echo "Found"; } } ?>