Keyword is an important part of making SEO friendly page, So we need to create keyword that is suitable for us yet popular keyword as for search engine. Creating list of keyword iss easy, but what about creating keyword that is popular now, you want the answer? then ask Yahoo..
This script made it easy using Yahoo API. Just provide a string and it will procesed it into rich keyword
This script created using cURL on PHP
The flow is
- Connect using POST to http://api.search.yahoo.com/ContentAnalysisService/V1/termExtraction'
- Bring Yahoo App ID and text content using POST method
- The output will be a XML file
- Parse the file to get the keywords
- done..
Process:
$string = 'Your text here, can be blog post, article, or just gibberish:)';
$post_data = array('appid' => 'YOUR',
'context' => urlencode($string));
$url = 'http://api.search.yahoo.com/ContentAnalysisService/V1/termExtraction';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$xml = curl_exec($ch);
curl_close($ch);
It will give an XML output.So we need to parse it:
$keywords = array();
$xml_walk = new XMLReader();
$xml_walk->XML($xml);
while ($xml_walk->read())
{
if ($xml_walk->value != '' && $xml_walk->depth == 2)
$keywords[] = $xml_walk->value . ', ';
}
So the full script wil be:
$string = 'Your text here, can be blog post, article, or just gibberish:)';
$post_data = array('appid' => 'YOU APP ID',
'context' => urlencode($string));
$url = 'http://api.search.yahoo.com/ContentAnalysisService/V1/termExtraction';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$xml = curl_exec($ch);
curl_close($ch);
$keywords = array();
$xml_walk = new XMLReader();
$xml_walk->XML($xml);
while ($xml_walk->read())
{
if ($xml_walk->value != '' && $xml_walk->depth == 2)
$keywords[] = $xml_walk->value . ', ';
}
You will need yahoo application developer to make this script work, to get it, just register at Yahoo, answer anything what they need to know, then you will get your ID right away.
But if you in a hurry, contact me to get my Yahoo Application ID