search
This is an old revision of the document!
<?php
function is_valid_domain_name($domain) {
return (preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $domain) // Valid characters check
&& preg_match("/^.{1,253}$/", $domain) // Overall length check
&& preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $domain)); // Length of each label
}
RT user: [email protected] $key = “I9mVVFUi5rMxNfaAUC8IjxbsJtm_bQOWsvtLbivlWmQ”; if (isset($_GET['search'])) { echo “Type: ”.$_GET['search'].“<br/><br/>”; } elseif (isset($_GET['apisearch'])) { echo “Type: ”.$_GET['apisearch'].“<br/><br/>”; } https://ranktank.net/search/?keyphrase=Test&domain=test.com&location=google.com&language=English&search=RankTank+Search
if($_GET['loc'] == “google.com”) {
$loc = "us";
} else {
$loc = substr($_GET['loc'],-2);
}
$domain = $_GET['d'];
if(is_valid_domain_name($domain)) {
echo "Keyphrase: ".$_GET['q']."<br/>";
echo "Domain: ".$_GET['d']."<br/>";
echo "Provider: ".$_GET['loc']."<br/>";
echo "Location:".$loc."<br/>";
echo "Language: ".$_GET['lang']."<br/>";
echo "Incognito: true<br/><br/>";
/*https://us-central1-ranktank-stage.cloudfunctions.net/getResult?
Parameters
provider=google.com&
q=test test test&
cr=us&
gl=us&
hl=en
&apikey=
Must have provider, q and apikey*/
$query_url = 'https://us-central1-ranktank-stage.cloudfunctions.net/getResult?apiKey='.$key.'&q='.urlencode($_GET['q']).'&provider='.$_GET['loc'].'&cr='.$loc.'&gl='.$loc.'&hl='.$_GET['lang'];
//$query_url = urlencode($query_url);
//$data = file_get_contents($query_url);
$data = '[
{
"rank":1,
"url":"https:\/\/www.directdebit.co.za\/",
"title":"Direct Debit: Enterprise Debit Order Collection Software System",
"meta":"Direct Debit is a debit order system and software facility provider, specialising in batch debit order collection from bank accounts and credit cards.",
"type":"Web"
},
{
"rank":2,
"url":"https:\/\/www.debitorder.com\/",
"title":"Debit Order Collection: Direct Debit",
"meta":"Direct Debit provides the best debit order collection system and processing service. Get quotes on NAEDO, AEDO and EFT debit order facilities and get paid.",
"type":"Web"
},
{
"rank":3,
"url":"https:\/\/en.wikipedia.org\/wiki\/Direct_debit",
"title":"Direct debit - Wikipedia",
"meta":"A Direct Debit or direct withdrawal is a financial transaction in which one person (or company) withdraws funds from another persons bank account. Formally",
"type":"Web"
},
{
"rank":4,
"url":"http:\/\/realpay.co.za\/",
"title":"Real Pay: Online Electronic, Direct Debit Orders System",
"meta":"Real Pay is top online debit orders system. Get registered payments system service and direct debits order collections solutions in South Africa.",
"type":"Web"
},
{
"rank":5,
"url":"https:\/\/www.businessonline.standardbank.com\/bol\/direct-debit-collection.html",
"title":"Direct Debits or Collections | Standard Bank",
"meta":"Collect payments easily from your customers with Standard Banks Business Online direct debit collection solution.Videos2:07Direct debitsACCCgovauYouTube - Nov 13, 20140:46How to cancel Direct Debits with the Barclays appBarclays UKYouTube - May 3, 20194:22What is DIRECT DEBIT? What does DIRECT DEBIT mean",
"type":"Web"
}
]';
$result = json_decode($data, true);
//$result = json_encode($result, JSON_PRETTY_PRINT);
//var_dump($result);
$i=0;
foreach ($result as $key => $value) {
$pos = strpos(parse_url($value["url"], PHP_URL_HOST), $domain);
if($pos !== false) {
$ranked = true;
break;
} else {
$ranked = false;
}
$i++;
}
if($ranked) {
if($pos === 0) {
echo "You are ranked <span style='color:#BE202E; font-size:24px;'>#".$result[$i]["rank"]."</span>.<br/>";
echo "Your rank is an exact match.<br/>";
} else {
echo "You are ranked <span style='color:#BE202E; font-size:24px;'>#".$result[$i]["rank"]."</span>.<br/>";
echo "Your rank is a partial match (you could be ranked for a subdomain).<br/>";
}
echo "Your ranked url is: ".parse_url($result[$i]["url"], PHP_URL_HOST);
} else {
echo "You are not ranked in the top 100 Google SERPs.";
}
/*
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $query_url,
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'
]);
$resp = curl_exec($curl);
var_dump($resp);
curl_close($curl);
$result = json_decode($resp, true);
*/
} else {
echo "Please provide a valid domain.<br/>";
}
echo '<br/><br/><fieldset>
<legend>Request</legend>
<input name="request" style="border: 0px; background-color:#EEEEEE; color:#BE202E; font-size:12px; font-family:monospace; width:100%; max-width:100%;" value="'.$_SERVER['REQUEST_URI'].'" />
</fieldset>
';
echo '<br/><br/><fieldset>
<legend>Reponse</legend>
<textarea name="response" rows="20" style="padding-top:20px; padding-bottom:20px; border: 0px; background-color:#EEEEEE; color:#BE202E; font-size:12px; font-family:monospace; width:100%; max-width:100%;">'.$data.'</textarea>
</fieldset>
';
?>
search.1570438260.txt.gz · Last modified: 2019/10/07 08:51 by jaco