You can generate these keywords using the following function:
function implodeAssoc($array, $inner_glue='=', $outer_glue='&') {
$output = array();
foreach( $array as $key => $item ){
$output[] = $key . $inner_glue . $item;
}
return implode($outer_glue, $output);
}
function getKeywords($text) {
$baseurl = 'http://search.yahooapis.com/ContentAnalysisService/V1/termExtraction';
$params = array('appid'=>'YahooDemo',
'context'=>urlencode($text),
'output'=>'php');
$request = $baseurl . '?' . implodeAssoc($params);
$xml = file_get_contents($request);
$result = unserialize($xml);
$keywords_array = $result['ResultSet']['Result'];
$keywords = implode(",",$keywords_array);
return($keywords);
}
echo getKeywords("Bill Gates to Finally Receive His Harvard Degree. It's not like he needs it to beef up his resume, but the world's richest college dropout is finally getting his degree. Bill Gates, chairman of Microsoft Corp.");
This will output:
bill gates,harvard degree,microsoft corp,college dropout,resume