<?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>Weblimner &#187; php</title>
	<atom:link href="http://www.weblimner.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.weblimner.com</link>
	<description></description>
	<lastBuildDate>Sun, 15 Aug 2010 23:49:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Using ReCaptcha on your Website</title>
		<link>http://www.weblimner.com/code/using-recaptcha-on-your-website/</link>
		<comments>http://www.weblimner.com/code/using-recaptcha-on-your-website/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 22:12:55 +0000</pubDate>
		<dc:creator>Ali Sipahioglu</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[captcha]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[recaptcha]]></category>

		<guid isPermaLink="false">http://www.weblimner.com/?p=123</guid>
		<description><![CDATA[As much as everyone hates those weird shaped characters, trying to figure out what it says so we can copy, we all hate spam too. ReCaptcha does a great job of creating &#8220;Captchas&#8221; for those spammers. In this article, I am going to explain how you can implement their API to your PHP based website. [...]]]></description>
			<content:encoded><![CDATA[<p>As much as everyone hates those weird shaped characters, trying to figure out what it says so we can copy, we all hate spam too. <a href="http://recaptcha.net/" target="_blank">ReCaptcha</a> does a great job of creating &#8220;<a href="http://en.wikipedia.org/wiki/CAPTCHA" target="_blank">Captchas</a>&#8221; for those spammers. In this article, I am going to explain how you can implement their API to your PHP based website. They do a great job of explaining it on their website on other programming languages too if you would like to take a look, its right <a href="http://recaptcha.net/resources.html" target="_blank">here</a>.<br/><br/><br />
<span id="more-123"></span><br />
First off, you need to go <a href="https://admin.recaptcha.net/accounts/signup/?next=%2Frecaptcha%2Fcreatesite%2F" target="_blank">here</a> and get an account. After you finish your sign up, you come to a page where you register your domain.<br/><br/></p>
<p>You don&#8217;t need create multiple accounts for multiple domains, all you need to do is check the checkbox right under your domain name.<br/><br/></p>

<a href="http://www.weblimner.com/wp-content/gallery/posts/1.gif" title="" class="thickbox" rel="singlepic18" >
	<img class="ngg-singlepic" src="http://www.weblimner.com/wp-content/gallery/cache/18__320x240_1.gif" alt="1" title="1" />
</a>

<p>Next, you get to this page with your API keys. Note those API keys since you are going to use them in your implementation. Obviously, mine are covered right now :)<br/><br/></p>

<a href="http://www.weblimner.com/wp-content/gallery/posts/2.gif" title="" class="thickbox" rel="singlepic19" >
	<img class="ngg-singlepic" src="http://www.weblimner.com/wp-content/gallery/cache/19__320x240_2.gif" alt="2" title="2" />
</a>

<p>Anyways, then you can either click &#8220;reCAPTCHA plugins and libraries&#8221; and figure out how to implement it yourself or read the rest of this post :) They do have explanations on <a href="http://recaptcha.net/plugins/aspnet/">ASP.Net</a> and <a href="http://recaptcha.net/resources.html">more</a> if you use a different language on your website. You can have different programming languages on different sites and still use the same API keys by the way.<br/><br/></p>
<p>Next, you need to download the library from <a href="http://code.google.com/p/recaptcha/downloads/list?q=label:phplib-Latest" target="_blank">here</a> and then upload it to your server. Now open the page where you post something, anything really.. that you want the reCaptcha to show up and enter the following code;<br/><br/></p>
<pre class="php">&lt;?php
require_once('recaptchalib.php');
$publickey = "Your public API key"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?&gt;
</pre>
<p>Note: You can put the first two lines in your global include file and then use the last line for the captcha to show up anywhere.<br/><br/></p>
<p>Now, open the page where you get the data from your form. Before you do any checks (e.g. Check empty fields, or email address validation), you want to check the captcha.<br/><br/></p>
<p>So include the following code in the beginning of your file;<br/><br/></p>
<pre class="php">&lt;?php
require_once('recaptchalib.php');
$privatekey = "Your private API key";
$resp = recaptcha_check_answer ($privatekey,
 $_SERVER["REMOTE_ADDR"],
 $_POST["recaptcha_challenge_field"],
 $_POST["recaptcha_response_field"]);
?&gt;
</pre>
<p>And where you want the check to happen include the following code;<br/><br/></p>
<pre class="php">&lt;?php
if (!$resp-&gt;is_valid) {
 echo "The reCAPTCHA wasn't entered correctly. Go back and try it again.";
}
?&gt;</pre>
<p><br/><br/></p>
<p>That&#8217;s it. You should be able to run the code now. Let me know, if you run into any problems and I will try to help.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weblimner.com/code/using-recaptcha-on-your-website/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)
Object Caching 280/322 objects using disk

Served from: www.weblimner.com @ 2012-02-06 03:12:53 -->
