Version: 0.1 Home: http://perassi.org/2007/11/19/filter-chaings-using-reflection/ License: GNU General Public License Version 3 (http://www.gnu.org/licenses/gpl.html) Notes: quick and dirty, indeed :) */ function debug($a) { echo "\n
\n";
print_r($a);
echo "\n\n";
}
// credits: http://qualitypoint.blogspot.com/2010/05/implementing-google-suggest-in-search.html
function get_items($q, $lang = 'it')
{
$url = "http://suggestqueries.google.com/complete/search?qu=" . $q . '&hl=' . $lang;
$text = file_get_contents($url);
$text = str_replace('window.google.ac.h(["' . $q . '",[[', '', $text);
$arr_items = explode('],[', $text);
$keys = array();
foreach($arr_items as $items) {
$arr_item = explode(',', $items);
$key = $arr_item[0];
$key = trim($key, '"');
if (strpos(strtolower($key), $q) !== false) {
$keys[] = $key;
}
}
return $keys;
}
// credits: http://www.bradino.com/php/alphabet-loop/
echo "