我正在使用以下脚本从 Google Suggestions 中提取信息:
<?php
function getKeywordSuggestionsFromGoogle($keyword) {
$keywords = array();
$data = file_get_contents('http://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl=en-US&q='.urlencode($keyword));
if (($data = json_decode($data, true)) !== null) {
$keywords = $data[1];
}
return $keywords;
}
var_dump(getKeywordSuggestionsFromGoogle('business'));
?>
这是在浏览器中访问 PHP 文件时显示的内容:
array(10) { [0]=> string(14) "business cards" [1]=> string(22) "business letter format" [2]=> string(16) "business insider" [3]=> string(15) "business casual" [4]=> string(13) "business plan" [5]=> string(22) "business plan template" [6]=> string(13) "business week" [7]=> string(14) "business ideas" [8]=> string(17) "business for sale" [9]=> string(8) "business" }
我需要弄清楚如何做两件事:
任何帮助将不胜感激!谢谢!