This class extracts the suggestion keywords from Overture (Yahoo! Search Marketing) together with their popularity counts.
/** return an array with this format: [keywords] => cnt */
function getRelateds() {
$vFile = ‘http://inventory.overture.com/d/searchinventory/suggestion/’;
$vFile .= ‘?term=’.urlencode($this->mBaseWords).’&mkt=us&lang=en_US’;
$vFile = file_get_contents($vFile);
$vFile = strip_tags($vFile);
$vPat = “/ ([0-9]+)\n (.+)/i”;
preg_match_all($vPat,$vFile,$vMatches);
//var_dump($vMatches);die;
$vCnts = $vMatches[1];
$vWords = array();
for ($i=0;$i
?>
Sample Output:
array 'dalat' => 1894 'dalat resort' => 426 'dalat nam viet' => 359 'dalat palace sofitel' => 97 'dalat hotel' => 91 'dalat school' => 63 'dalat flower' => 62 'bi dalat vo' => 60 'city dalat' => 59
Leave a Reply