<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PHP Tutorials &#187; yahoo api</title>
	<atom:link href="http://phpcollection.com/category/yahoo-api/feed/" rel="self" type="application/rss+xml" />
	<link>http://phpcollection.com</link>
	<description>PHP Tutorials collection</description>
	<lastBuildDate>Tue, 01 May 2012 12:39:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Spell Check in PHP with Yahoo API</title>
		<link>http://phpcollection.com/spell-check-php-yahoo-api/</link>
		<comments>http://phpcollection.com/spell-check-php-yahoo-api/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 09:29:34 +0000</pubDate>
		<dc:creator>Php Ninza</dc:creator>
				<category><![CDATA[yahoo api]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Spell Check]]></category>

		<guid isPermaLink="false">http://www.phpcollection.com/?p=554</guid>
		<description><![CDATA[Spell Check is a very nifty feature that a developer need to know , Especially when creating htaccess rewrite rules dynamically you will not want your URL&#8217;s to have index with wrong spellings , As this will hamper your SEO performance. Here is a very easy tool that a developer can implement in their applications [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Spell Check is a very nifty feature that a developer need to know , Especially when creating <a href="http://www.phpcollection.com/correct-htaccess-structure.html">htaccess rewrite rules</a> dynamically you will not want your URL&#8217;s to have index with wrong spellings , As this will hamper your SEO performance.</p>
<p>Here is a very easy tool that a developer can implement in their applications for checking the spellings, I have used this API when the users are searching on my web app !, This search make SEO URL&#8217;s which i don&#8217;t want to index in a incorrect manner.<br />
<script type="text/javascript"><!--
google_ad_client = "pub-7185707610518533";
/* 468x15, created 7/18/09 */
google_ad_slot = "4241642759";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
<span id="more-554"></span><br />
For using Yahoo <a href="http://developer.yahoo.com/search/web/V1/spellingSuggestion.html">SpellCheck API </a> first you need to register a <a href="https://developer.yahoo.com/wsregapp/">Application ID</a> ! This Application ID will be used to monitor your API calls .</p>
<p>We will be simply making a function here named spell_check which will check the spellings wherever you require.</p>
<p>Let&#8217;s create a file name spellcheck.php and put the code given below in that file.</p>
<pre class="php">
< ?php
function spell_check ($query)
{
// Substitute this application ID with your own application ID provided by Yahoo!.
$appID = "Your App Id here";

// URI used for making REST call. Each Web Service uses a unique URL.
$request = "http://search.yahooapis.com/WebSearchService/V1/spellingSuggestion?appid=$appID&#038;query=".urlencode($query);

// Initialize the session by passing the request as a parameter
$session = curl_init($request);

// Set curl options by passing session and flags
// CURLOPT_HEADER allows us to receive the HTTP header
curl_setopt($session, CURLOPT_HEADER, true);

// CURLOPT_RETURNTRANSFER will return the response
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);

// Make the request
$response = curl_exec($session);

// Close the curl session
curl_close($session);

// Get the XML from the response, bypassing the header
if (!($xml = strstr($response, '&lt;?xml'))) {
        $xml = null;
}

// Create a SimpleXML object with XML response
$simple_xml = simplexml_load_string($xml);

// Traverse XML tree and save desired values from child nodes
	$data = $simple_xml->Result;
	return $data;
}
?>
</pre>
<p>Above code uses Curl to fetch the API url contents and return the correct spelling , Please change $appID variable with your yahoo App id key.</p>
<p>Once you have created spellcheck.php, Just call this file in a php page and use spell_check function to parse the wrong spellings and correct the data.</p>
<p>Example given below</p>
<pre class="php">
include ("spellcheck.php");
$correct_spelling = spell_check($wrong_spelling);
echo $correct_spelling;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://phpcollection.com/spell-check-php-yahoo-api/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>

