Created
March 13, 2015 03:00
-
-
Save ridho1991/772754dc14e618be66f9 to your computer and use it in GitHub Desktop.
Bing Keyword Suggest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function bing_suggest($query) { | |
$geturl = file_get_contents ( utf8_encode ( "http://api.bing.com/osjson.aspx?query=" . $query . "" ) ); | |
$keywords = json_decode ( $geturl, 1 ); | |
$suggest=array(); | |
if(isset($keywords[0])) { | |
$z = 1; | |
foreach($keywords[1] as $keys) { | |
$suggest [] = $keys; | |
$z++; | |
} | |
} | |
return $suggest; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Bing Keyword Suggest</title> | |
</head> | |
<body> | |
<form action="keyword.php" method="get"> | |
<input type="text" id="q" name="q" value="" placeholder="Enter text here"/> | |
<button type="submit" value="" >Submit</button> | |
</form> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title><?php echo $_GET['q'];;?></title> | |
<meta charset="UTF-8"> | |
</head> | |
<body> | |
<?php | |
ini_set('max_execution_time', 0); | |
ini_set('memory_limit', '999M'); | |
require_once('api.php'); | |
$q=$_GET['q']; | |
$bing_key=bing_suggest($q); | |
foreach($bing_key as $key){ | |
echo $key.'<br>'; | |
} | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment