<?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>vijayjoshi.org &#187; PHP</title>
	<atom:link href="http://www.vijayjoshi.org/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vijayjoshi.org</link>
	<description>php &#124; javascript &#124; ajax &#124; and all things web</description>
	<lastBuildDate>Sun, 20 Nov 2011 15:24:32 +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>PHP: Get intersecting dates between 2 date ranges</title>
		<link>http://www.vijayjoshi.org/2011/09/07/php-get-intersecting-dates-between-2-date-ranges/</link>
		<comments>http://www.vijayjoshi.org/2011/09/07/php-get-intersecting-dates-between-2-date-ranges/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 20:38:51 +0000</pubDate>
		<dc:creator>Vijay Joshi</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.vijayjoshi.org/?p=1212</guid>
		<description><![CDATA[
			
				
			
		
Here is a small code snippet that will give you intersecting dates between 2 date ranges. Say, for example, you have 2 date ranges, 1-Jan-2011 to 31-Mar-2011 and 23-Feb-2011 to 4-May-2011.  This function will give you 23-Feb-2011 to 31-Mar-2011 as result.
Here is the code:
$a1  = "2011-01-01";
$a2  = "2011-03-31";
$b1  = "2011-02-23";
$b2  = "2011-05-04";

$intersection = getIntersection($a1,$a2,$b1,$b2);
if($intersection === false)
{
	echo ...]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop --><!-- End Shareaholic LikeButtonSetTop --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F09%2F07%2Fphp-get-intersecting-dates-between-2-date-ranges%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F09%2F07%2Fphp-get-intersecting-dates-between-2-date-ranges%2F&amp;source=v08i&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Here is a small code snippet that will give you intersecting dates between 2 date ranges. Say, for example, you have 2 date ranges, 1-Jan-2011 to 31-Mar-2011 and 23-Feb-2011 to 4-May-2011.  This function will give you 23-Feb-2011 to 31-Mar-2011 as result.</p>
<p>Here is the code:</p>
<pre class="brush:php">$a1  = "2011-01-01";
$a2  = "2011-03-31";
$b1  = "2011-02-23";
$b2  = "2011-05-04";

$intersection = getIntersection($a1,$a2,$b1,$b2);
if($intersection === false)
{
	echo 'No intersecting dates found';
}
else
{
	echo 'From '.date('d-M-Y', $intersection['start']).' till '.date('d-M-Y', $intersection['end']);
}

function getIntersection($a1,$a2,$b1,$b2)
{
	$a1 = strtotime($a1);
	$a2 = strtotime($a2);
	$b1 = strtotime($b1);
	$b2 = strtotime($b2);
	if($b1 &gt; $a2 || $a1 &gt; $b2 || $a2 &lt; $a1 || $b2 &lt; $b1)
	{
		return false;
	}
	$start = $a1 &lt; $b1 ? $b1 : $a1;
	$end = $a2 &lt; $b2 ? $a2 : $b2;

	return array('start' =&gt; $start, 'end' =&gt; $end);
}</pre>
<p>Above will show the following on browser :</p>
<pre class="brush:plain">From 23-Feb-2011 till 31-Mar-2011</pre>
<p>If the 2 date ranges have any intersecting dates, an array will be returned which will have <em>start </em>and <em>end </em>elements that represent the beginning and end of intersecting range.  Set of dates given below will return <em>false </em>as there are no intersecting dates.</p>
<pre class="brush:php">$a1  = "2011-01-01";
$a2  = "2011-03-31";
$b1  = "2011-04-23";
$b2  = "2011-05-04";

$intersection = getIntersection($a1,$a2,$b1,$b2);</pre>
<p>This will show</p>
<pre class="brush:plain">No intersecting dates found</pre>
<p>The code is self-explanatory. As you can see, first we have used php function <em>strtotime </em>to convert all dates to timestamps. Then we can compare them easily. This way you can use whatever(allowed) date format you wish.</p>
<div class="shr-publisher-1212"></div><!-- Start Shareaholic LikeButtonSetBottom --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:right;height:30px;'><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F09%2F07%2Fphp-get-intersecting-dates-between-2-date-ranges%2F' data-shr_title='PHP%3A+Get+intersecting+dates+between+2+date+ranges'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom -->]]></content:encoded>
			<wfw:commentRss>http://www.vijayjoshi.org/2011/09/07/php-get-intersecting-dates-between-2-date-ranges/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP class for expanding and shortening URLs using Google URL shortener API</title>
		<link>http://www.vijayjoshi.org/2011/01/21/php-class-for-expanding-and-shortening-urls-using-google-url-shortener-api/</link>
		<comments>http://www.vijayjoshi.org/2011/01/21/php-class-for-expanding-and-shortening-urls-using-google-url-shortener-api/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 19:55:14 +0000</pubDate>
		<dc:creator>Vijay Joshi</dc:creator>
				<category><![CDATA[JSON]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.vijayjoshi.org/?p=1156</guid>
		<description><![CDATA[
			
				
			
		
I have combined the 2 previous posts for expanding and shortening goo.gl URLs and have created a small class for it. Below is the download link for the class.

Expanding a URL
&#60;?php
include('GAPIClass.php');

$objAPI = new GAPIClass('your_api_key_here');
$result = $objAPI-&#62;expand('http://goo.gl/WlFX');
if(FALSE === $result)
{
	echo $objAPI-&#62;error;
}
else
{
	echo 'Long URL:'.$result;
}
?&#62;
Shorten A URL
&#60;?php
include('GAPIClass.php');

$objAPI = new GAPIClass('your_api_key_here');
$result = $objAPI-&#62;shorten('https://www.packtpub.com/php-jquery-cookbook-to-create-interactive-web-applications/book');

if(FALSE === $result)
{
	echo $objAPI-&#62;error;
}
else
{
	echo 'Short URL:'.$result;
}
?&#62;
As I have mentioned earlier that Google recommends ...]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop --><!-- End Shareaholic LikeButtonSetTop --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F21%2Fphp-class-for-expanding-and-shortening-urls-using-google-url-shortener-api%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F21%2Fphp-class-for-expanding-and-shortening-urls-using-google-url-shortener-api%2F&amp;source=v08i&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I have combined the 2 previous posts for <a href="http://www.vijayjoshi.org/2011/01/12/using-php-and-curl-to-expand-urls-using-google-url-shortener-api/">expanding </a>and <a href="http://www.vijayjoshi.org/2011/01/12/php-shorten-urls-using-google-url-shortener-api/">shortening</a> goo.gl URLs and have created a small class for it. Below is the download link for the class.</p>
<p><a href="http://www.vijayjoshi.org/examples/GAPIClass.php.txt"><img class="aligncenter size-full wp-image-451" title="Download GAPIClass" src="http://www.vijayjoshi.org/wp-content/uploads/download.png" alt="Download GAPIClass" width="180" height="45" /></a></p>
<h4><span style="text-decoration: underline;">Expanding a URL</span></h4>
<pre class="brush:php">&lt;?php
include('GAPIClass.php');

$objAPI = new GAPIClass('your_api_key_here');
$result = $objAPI-&gt;expand('http://goo.gl/WlFX');
if(FALSE === $result)
{
	echo $objAPI-&gt;error;
}
else
{
	echo 'Long URL:'.$result;
}
?&gt;</pre>
<h4><span style="text-decoration: underline;">Shorten A URL</span></h4>
<pre class="brush:php">&lt;?php
include('GAPIClass.php');

$objAPI = new GAPIClass('your_api_key_here');
$result = $objAPI-&gt;shorten('https://www.packtpub.com/php-jquery-cookbook-to-create-interactive-web-applications/book');

if(FALSE === $result)
{
	echo $objAPI-&gt;error;
}
else
{
	echo 'Short URL:'.$result;
}
?&gt;</pre>
<p>As I have mentioned earlier that Google recommends an API key. The class has a flag variable called <em><strong>keyWarning</strong></em>. By default it is true and it will show the following warning message if you do not pass an API key while instantiating the class:</p>
<blockquote><p>Currently you are not using an API key. It is recommended that you use one. <a href="http://code.google.com/apis/urlshortener/v1/authentication.html#key">Click here to learn more about the API key</a></p></blockquote>
<p>To turn this notification off, just use this line:</p>
<pre class="brush:php">$objAPI-&gt;keyWarning = false;</pre>
<p><a href="http://www.vijayjoshi.org/examples/GAPIClass.php.txt"><img class="aligncenter size-full wp-image-451" title="Download GAPIClass" src="http://www.vijayjoshi.org/wp-content/uploads/download.png" alt="Download GAPIClass" width="180" height="45" /></a></p>
<div class="shr-publisher-1156"></div><!-- Start Shareaholic LikeButtonSetBottom --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:right;height:30px;'><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F21%2Fphp-class-for-expanding-and-shortening-urls-using-google-url-shortener-api%2F' data-shr_title='PHP+class+for+expanding+and+shortening+URLs+using+Google+URL+shortener+API'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom -->]]></content:encoded>
			<wfw:commentRss>http://www.vijayjoshi.org/2011/01/21/php-class-for-expanding-and-shortening-urls-using-google-url-shortener-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Internal Server Error 500 in wp-admin</title>
		<link>http://www.vijayjoshi.org/2011/01/13/wordpress-internal-server-error-500-in-wp-admin/</link>
		<comments>http://www.vijayjoshi.org/2011/01/13/wordpress-internal-server-error-500-in-wp-admin/#comments</comments>
		<pubDate>Thu, 13 Jan 2011 08:01:15 +0000</pubDate>
		<dc:creator>Vijay Joshi</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.vijayjoshi.org/?p=1101</guid>
		<description><![CDATA[
			
				
			
		
If you are getting an internal server error 500 after installing wordpress while accessing admin, here is the fix.
Most likely it is caused by low memory limit on your server. To fix it, create a new file named php.ini in you wp-admin directory and put the following line in it.
memory_limit = 64M
Save the file, then reload the admin page and ...]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop --><!-- End Shareaholic LikeButtonSetTop --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F13%2Fwordpress-internal-server-error-500-in-wp-admin%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F13%2Fwordpress-internal-server-error-500-in-wp-admin%2F&amp;source=v08i&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>If you are getting an internal server error 500 after installing wordpress while accessing admin, here is the fix.</p>
<p>Most likely it is caused by low memory limit on your server. To fix it, create a new file named <em><strong>php.ini</strong></em> in you <strong><em>wp-admin</em></strong> directory and put the following line in it.</p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; line-height: 18px; white-space: pre;">memory_limit = 64M</span></p>
<p>Save the file, then reload the admin page and it will work fine.</p>
<div class="shr-publisher-1101"></div><!-- Start Shareaholic LikeButtonSetBottom --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:right;height:30px;'><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F13%2Fwordpress-internal-server-error-500-in-wp-admin%2F' data-shr_title='Wordpress+Internal+Server+Error+500+in+wp-admin'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom -->]]></content:encoded>
			<wfw:commentRss>http://www.vijayjoshi.org/2011/01/13/wordpress-internal-server-error-500-in-wp-admin/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>PHP: Shorten URLs using Google URL shortener API</title>
		<link>http://www.vijayjoshi.org/2011/01/12/php-shorten-urls-using-google-url-shortener-api/</link>
		<comments>http://www.vijayjoshi.org/2011/01/12/php-shorten-urls-using-google-url-shortener-api/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 06:27:42 +0000</pubDate>
		<dc:creator>Vijay Joshi</dc:creator>
				<category><![CDATA[JSON]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.vijayjoshi.org/?p=1093</guid>
		<description><![CDATA[
			
				
			
		
In past 2 posts you saw how short URLs can be expanded using the Google URL shortener API. This post shows how URLs can be shortened using this API.
API key is not mandatory for test purpose. Use this link to get an API key.
For shortening URLs, 2 points must be noted. First, a HTTP POST is required and the post data ...]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop --><!-- End Shareaholic LikeButtonSetTop --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F12%2Fphp-shorten-urls-using-google-url-shortener-api%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F12%2Fphp-shorten-urls-using-google-url-shortener-api%2F&amp;source=v08i&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>In past 2 posts you saw how short URLs can be expanded using the Google URL shortener API. This post shows how URLs can be shortened using this API.</p>
<p>API key is not mandatory for test purpose. <a title="Get API Key" href="http://code.google.com/apis/console/">Use this link to get an API key.</a></p>
<p><a title="Get API Key" href="http://code.google.com/apis/console/"></a>For shortening URLs, 2 points must be noted. First, a HTTP POST is required and the post data should be in JSON format. Here is the code:</p>
<pre class="brush:php">//This is the URL you want to shorten
$longUrl = 'https://www.packtpub.com/php-jquery-cookbook-to-create-interactive-web-applications/book';
$apiKey = 'your_api_key_here';
//Get API key from : http://code.google.com/apis/console/

$postData = array('longUrl' =&gt; $longUrl, 'key' =&gt; $apiKey);
$jsonData = json_encode($postData);

$curlObj = curl_init();

curl_setopt($curlObj, CURLOPT_URL, 'https://www.googleapis.com/urlshortener/v1/url');
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curlObj, CURLOPT_HEADER, 0);
curl_setopt($curlObj, CURLOPT_HTTPHEADER, array('Content-type:application/json'));
curl_setopt($curlObj, CURLOPT_POST, 1);
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $jsonData);

$response = curl_exec($curlObj);

//change the response json string to object
$json = json_decode($response);

curl_close($curlObj);

echo 'Shortened URL is: '.$json-&gt;id;</pre>
<p>Here is the JSON response from Google:</p>
<pre class="brush:js">{
 "kind": "urlshortener#url",
 "id": "http://goo.gl/lBfOH",
 "longUrl": "https://www.packtpub.com/php-jquery-cookbook-to-create-interactive-web-applications/book"
}</pre>
<p>You can also read these:</p>
<ul>
<li><a href="http://www.vijayjoshi.org/2011/01/21/php-class-for-expanding-and-shortening-urls-using-google-url-shortener-api/">PHP class for expanding and shortening URLs using Google URL shortener API</a></li>
<li><a href="http://www.vijayjoshi.org/2011/01/12/using-php-and-curl-to-expand-urls-using-google-url-shortener-api/">Expanding URLs using cURL</a></li>
<li><a href="http://www.vijayjoshi.org/2011/01/11/php-expanding-urls-using-google-url-shortener-api/">Expand URLs using file_get_contents</a></li>
</ul>
<div class="shr-publisher-1093"></div><!-- Start Shareaholic LikeButtonSetBottom --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:right;height:30px;'><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F12%2Fphp-shorten-urls-using-google-url-shortener-api%2F' data-shr_title='PHP%3A+Shorten+URLs+using+Google+URL+shortener+API'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom -->]]></content:encoded>
			<wfw:commentRss>http://www.vijayjoshi.org/2011/01/12/php-shorten-urls-using-google-url-shortener-api/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Using PHP and cURL to expand URLs using Google URL shortener API</title>
		<link>http://www.vijayjoshi.org/2011/01/12/using-php-and-curl-to-expand-urls-using-google-url-shortener-api/</link>
		<comments>http://www.vijayjoshi.org/2011/01/12/using-php-and-curl-to-expand-urls-using-google-url-shortener-api/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 18:49:03 +0000</pubDate>
		<dc:creator>Vijay Joshi</dc:creator>
				<category><![CDATA[JSON]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.vijayjoshi.org/?p=1082</guid>
		<description><![CDATA[
			
				
			
		
Yesterday I wrote this post explaining how short goo.gl URLs can be expanded using the newly launched goo.gl API. In that code we used php function get_file_contents to get the response from API.
How about implementing the same functionality using cURL now? If you have libcurl support installed with PHP, you are ready to use the cURL functions of PHP.
Here is ...]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop --><!-- End Shareaholic LikeButtonSetTop --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F12%2Fusing-php-and-curl-to-expand-urls-using-google-url-shortener-api%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F12%2Fusing-php-and-curl-to-expand-urls-using-google-url-shortener-api%2F&amp;source=v08i&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Yesterday I wrote <a href="http://www.vijayjoshi.org/2011/01/11/php-expanding-urls-using-google-url-shortener-api/">this post</a> explaining how short <a title="Google URL shortener" href="http://goo.gl">goo.gl</a> URLs can be expanded using the newly launched goo.gl API. In that code we used php function <strong><em>get_file_contents</em></strong> to get the response from API.</p>
<p>How about implementing the same functionality using cURL now? If you have<strong> libcurl</strong> support installed with PHP, you are ready to use the cURL functions of PHP.</p>
<p>Here is the code. API key is not mandatory but Google recommends that you use one. It will increase your per day usage limits too. <a title="Google API key" href="http://code.google.com/apis/console/">Follow this link</a> to get an API key.</p>
<pre class="brush:php">$shortUrl = 'http://goo.gl/WlFX';
$apiKey = 'your_api_key_here';

$curlObj = curl_init();

curl_setopt($curlObj, CURLOPT_URL, 'https://www.googleapis.com/urlshortener/v1/url?shortUrl='.$shortUrl.'&amp;key='.$apiKey);
curl_setopt($curlObj, CURLOPT_HEADER, 0);
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, 0);

$response = curl_exec($curlObj);

curl_close($curlObj);
$json = json_decode($response);

if($json-&gt;status === "OK")
{
	echo $json-&gt;longUrl;
}
else
{
	echo 'Bad luck.';
}</pre>
<p>And here is the full JSON response:</p>
<pre class="brush:js">{
 "kind": "urlshortener#url",
 "id": "http://goo.gl/WlFX",
 "longUrl": "https://www.packtpub.com/php-jquery-cookbook-to-create-interactive-web-applications/book",
 "status": "OK"
}</pre>
<p>Am important point to note. Since the API is on https, set the value for <strong><em>CURLOPT_SSL_VERIFYPEER</em></strong> to false. This will stop cURL from verifying the SSL certificate.</p>
<div class="shr-publisher-1082"></div><!-- Start Shareaholic LikeButtonSetBottom --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:right;height:30px;'><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F12%2Fusing-php-and-curl-to-expand-urls-using-google-url-shortener-api%2F' data-shr_title='Using+PHP+and+cURL+to+expand+URLs+using+Google+URL+shortener+API'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom -->]]></content:encoded>
			<wfw:commentRss>http://www.vijayjoshi.org/2011/01/12/using-php-and-curl-to-expand-urls-using-google-url-shortener-api/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PHP: Expanding URLs using Google URL shortener API</title>
		<link>http://www.vijayjoshi.org/2011/01/11/php-expanding-urls-using-google-url-shortener-api/</link>
		<comments>http://www.vijayjoshi.org/2011/01/11/php-expanding-urls-using-google-url-shortener-api/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 08:22:12 +0000</pubDate>
		<dc:creator>Vijay Joshi</dc:creator>
				<category><![CDATA[JSON]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.vijayjoshi.org/?p=1073</guid>
		<description><![CDATA[
			
				
			
		
Yesterday. google launched an API for its URL shortening service http://goo.gl. Using this API developers will be able to expand/shorten URLs and get a user&#8217;s analytics and history programmaticaly.
Below is a small snippet of PHP code that expands a short URL. The response comes in JSON format, so we will use the json_decode function to convert it to object.
$shortUrl = 'http://goo.gl/WlFX';
$response ...]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop --><!-- End Shareaholic LikeButtonSetTop --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F11%2Fphp-expanding-urls-using-google-url-shortener-api%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F11%2Fphp-expanding-urls-using-google-url-shortener-api%2F&amp;source=v08i&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Yesterday. google <a title="Google URL shortener API" href="http://googlecode.blogspot.com/2011/01/google-url-shortener-gets-api.html">launched an API</a> for its URL shortening service <a href="http://goo.gl">http://goo.gl</a>. Using this API developers will be able to expand/shorten URLs and get a user&#8217;s analytics and history programmaticaly.</p>
<p>Below is a small snippet of PHP code that expands a short URL. The response comes in JSON format, so we will use the <strong><em>json_decode</em></strong> function to convert it to object.</p>
<pre class="brush:php">$shortUrl = 'http://goo.gl/WlFX';
$response = file_get_contents('https://www.googleapis.com/urlshortener/v1/url?shortUrl='.$shortUrl);
$json = json_decode($response);

if($json-&gt;status === "OK")
{
	echo $json-&gt;longUrl;
}
else
{
	echo 'Bad luck.';
}</pre>
<p>Here is the full successfull response in JSON format.</p>
<pre class="brush:js">{
 "kind": "urlshortener#url",
 "id": "http://goo.gl/WlFX",
 "longUrl": "https://www.packtpub.com/php-jquery-cookbook-to-create-interactive-web-applications/book",
 "status": "OK"
}</pre>
<p>Finally, note that Google recommends the use of an API key. You can <a title="Google API Key" href="http://code.google.com/apis/console-help/#UsingKeys">visit this link</a> to read more about key and get a key from <a href="http://code.google.com/apis/console/">this link</a>.</p>
<p>After using the key, your URL will look like the following:</p>
<pre class="brush:php">$shortUrl = 'http://goo.gl/WlFX';
$apiKey = 'your_key_here';
$response = file_get_contents('https://www.googleapis.com/urlshortener/v1/url?shortUrl='.$shortUrl.'&amp;key='.$apiKey);</pre>
<div class="shr-publisher-1073"></div><!-- Start Shareaholic LikeButtonSetBottom --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:right;height:30px;'><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F11%2Fphp-expanding-urls-using-google-url-shortener-api%2F' data-shr_title='PHP%3A+Expanding+URLs+using+Google+URL+shortener+API'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom -->]]></content:encoded>
			<wfw:commentRss>http://www.vijayjoshi.org/2011/01/11/php-expanding-urls-using-google-url-shortener-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: Defining configuration values</title>
		<link>http://www.vijayjoshi.org/2011/01/07/php-defining-configuration-values/</link>
		<comments>http://www.vijayjoshi.org/2011/01/07/php-defining-configuration-values/#comments</comments>
		<pubDate>Fri, 07 Jan 2011 15:09:32 +0000</pubDate>
		<dc:creator>Vijay Joshi</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Resources]]></category>

		<guid isPermaLink="false">http://www.vijayjoshi.org/?p=1024</guid>
		<description><![CDATA[
			
				
			
		
Every web application requires configuration files which contain values that are used throughout the application. In this post we will look at some of the methods developers use to define configuration settings and also what should be avoided.
The ugly way
I have seen many many developers do this and am myself guilty of doing it during my initial coding days. Consider ...]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop --><!-- End Shareaholic LikeButtonSetTop --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F07%2Fphp-defining-configuration-values%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F07%2Fphp-defining-configuration-values%2F&amp;source=v08i&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Every web application requires configuration files which contain values that are used throughout the application. In this post we will look at some of the methods developers use to define configuration settings and also what should be avoided.</p>
<h3>The ugly way</h3>
<p>I have seen many many developers do this and am myself guilty of doing it during my initial coding days. Consider the following code.</p>
<pre class="brush:php">//development
	define("HOST", "localhost");
	define("DATABASE_USER", "root");
	define("DATABASE_PASSWORD", "something");
	define("DATABASE_NAME", "UJNEEA");
	define('FILE_UPLOAD_PATH', 'C:/wamp/www/project/uploads/');

/*
	//production
	define("HOST", "localhost");
	define("DATABASE_USER", "username");
	define("DATABASE_PASSWORD", "password");
	define("DATABASE_NAME", "liveDB");
	define('FILE_UPLOAD_PATH', '/home/project/public_html/uploads/');
*/</pre>
<p>Developers define 2 sets of same variables for each environment. First set is for development environment while second is for production. To switch the configuration developer must comment all other sets and uncomment the desired one. This is untidy and error prone. <strong>Never ever use this in your applications.</strong></p>
<p><strong><span id="more-1024"></span><br />
</strong></p>
<h3>Using a flag</h3>
<p>Above method can be significantly improved by using a variable as a flag. The example is given below.</p>
<pre class="brush:php">define ('DEVELOPMENT', true);

if(DEVELOPMENT)
{
	define("HOST", "localhost");
	define("DATABASE_USER", "root");
	define("DATABASE_PASSWORD", "something");
	define("DATABASE_NAME", "myDB");
	define('FILE_UPLOAD_PATH', 'C:/wamp/www/project/uploads/');
}
else
{
	define("HOST", "localhost");
	define("DATABASE_USER", "username");
	define("DATABASE_PASSWORD", "password");
	define("DATABASE_NAME", "liveDB");
	define('FILE_UPLOAD_PATH', '/home/project/public_html/uploads/');
}</pre>
<p>Define a variable which will tell whether it is a development environment or a production one. Now when you have to switch environments, you do not have to do that comment/uncomment stuff. Just set the flag to true or false and PHP will pick the values accordingly.</p>
<h3>Using multi-dimensional arrays</h3>
<p>If you have used CodeIgniter, you must be familiar with this concept. Just use multi-dimensional arrays. Here is the explanation from CodeIgniter documentation itself.</p>
<blockquote><p>&#8220;The reason we use a multi-dimensional array rather than a more simple one is to permit you to optionally store  multiple sets of connection values. If, for example, you run multiple environments (development, production, test, etc.) under a single installation, you can set up a connection group for each, then switch between groups as needed.&#8221;</p></blockquote>
<pre class="brush:php">$active_group = "test";

$db['default']['hostname'] = "localhost";
$db['default']['username'] = "root";
$db['default']['password'] = "pass";
$db['default']['database'] = "someDB";
$db['default']['file_upload_path'] = "C:/wamp/www/project/uploads/'";

$db['test']['hostname'] = "otherHost";
$db['test']['username'] = "root";
$db['test']['password'] = "password";
$db['test']['database'] = "hci";
$db['test']['file_upload_path'] = "C:/wamp/www/project/uploads/'";

$db['staging']['hostname'] = "evenAnotherHost";
$db['staging']['username'] = "root";
$db['staging']['password'] = "password";
$db['staging']['database'] = "dbname";
$db['staging']['file_upload_path'] = "E:/public_html/project/uploads/'";</pre>
<p>In this method, you only have to set the value of variable <strong><em>$active_group</em></strong> to whatever environment you wish to point to. This is much cleaner and configuration for more then 2 environments can be defined.</p>
<h3>Other methods</h3>
<p>There are many more ways you can define your configuration files. Some of them include:</p>
<ul>
<li>ini files</li>
<li>XML</li>
<li>YAML</li>
</ul>
<p>I will explain parsing the ini file using <strong><em>parse_ini_file</em></strong> function in an upcoming article.</p>
<p>Thanks for reading.</p>
<div class="shr-publisher-1024"></div><!-- Start Shareaholic LikeButtonSetBottom --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:right;height:30px;'><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F07%2Fphp-defining-configuration-values%2F' data-shr_title='PHP%3A+Defining+configuration+values'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom -->]]></content:encoded>
			<wfw:commentRss>http://www.vijayjoshi.org/2011/01/07/php-defining-configuration-values/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with XML Documents in PHP and jQuery</title>
		<link>http://www.vijayjoshi.org/2010/12/23/working-with-xml-documents-in-php-and-jquery/</link>
		<comments>http://www.vijayjoshi.org/2010/12/23/working-with-xml-documents-in-php-and-jquery/#comments</comments>
		<pubDate>Thu, 23 Dec 2010 10:17:15 +0000</pubDate>
		<dc:creator>Vijay Joshi</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Resources]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.vijayjoshi.org/?p=881</guid>
		<description><![CDATA[
			
				
			
		
Here is one more sample chapter from my book. It explains reading, writing and editing XML files with PHP and jQuery. Below are the chapter contents.
Loading XML from files and strings using SimpleXML
Accessing elements and attributes using SimpleXML
Searching elements using XPath
Reading an XML using DOM extension
Creating an XML using DOM extension
Modifying an XML using DOM extension
Parsing XML with jQuery

Loading XML ...]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop --><!-- End Shareaholic LikeButtonSetTop --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2010%2F12%2F23%2Fworking-with-xml-documents-in-php-and-jquery%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2010%2F12%2F23%2Fworking-with-xml-documents-in-php-and-jquery%2F&amp;source=v08i&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Here is one more sample chapter from <a title="PHP jQuery Cookbook" href="http://www.vijayjoshi.org/2010/11/22/guys-i-am-writing-a-book/">my book</a>. It explains reading, writing and editing XML files with PHP and jQuery. Below are the chapter contents.</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Loading XML from files and strings using SimpleXML</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Accessing elements and attributes using SimpleXML</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Searching elements using XPath</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Reading an XML using DOM extension</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Creating an XML using DOM extension</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Modifying an XML using DOM extension</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Parsing XML with jQuery</div>
<ul>
<li>Loading XML from files and strings using SimpleXML</li>
<li>Accessing elements and attributes using SimpleXML</li>
<li>Searching elements using XPath</li>
<li>Reading an XML using DOM extension</li>
<li>Creating an XML using DOM extension</li>
<li>Modifying an XML using DOM extension</li>
<li>Parsing XML with jQuery</li>
</ul>
<p>To read the full chapter follow this link - <a title="Working with XML in PHP and jQuery" href="https://www.packtpub.com/article/working-with-xml-documents">https://www.packtpub.com/article/working-with-xml-documents</a></p>
<p>You can also read the chapter on <a title="JSON with PHP and jQuery" href="http://www.vijayjoshi.org/2010/12/20/working-with-json-in-php-and-jquery/">using JSON with PHP and jQuery</a>.</p>
<div class="shr-publisher-881"></div><!-- Start Shareaholic LikeButtonSetBottom --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:right;height:30px;'><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.vijayjoshi.org%2F2010%2F12%2F23%2Fworking-with-xml-documents-in-php-and-jquery%2F' data-shr_title='Working+with+XML+Documents+in+PHP+and+jQuery'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom -->]]></content:encoded>
			<wfw:commentRss>http://www.vijayjoshi.org/2010/12/23/working-with-xml-documents-in-php-and-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with JSON in PHP and jQuery</title>
		<link>http://www.vijayjoshi.org/2010/12/20/working-with-json-in-php-and-jquery/</link>
		<comments>http://www.vijayjoshi.org/2010/12/20/working-with-json-in-php-and-jquery/#comments</comments>
		<pubDate>Mon, 20 Dec 2010 11:56:18 +0000</pubDate>
		<dc:creator>Vijay Joshi</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Resources]]></category>

		<guid isPermaLink="false">http://www.vijayjoshi.org/?p=853</guid>
		<description><![CDATA[
			
				
			
		
I mentioned in a previous post that I was writing a book on PHP and jQuery. Well, after a labor of around 7 months the book is out now. It is available on Packt website as well as Amazon.
Meanwhile, to help you make a decision, a sample chapter from the book is available on Packt website. The chapter is Working ...]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop --><!-- End Shareaholic LikeButtonSetTop --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2010%2F12%2F20%2Fworking-with-json-in-php-and-jquery%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2010%2F12%2F20%2Fworking-with-json-in-php-and-jquery%2F&amp;source=v08i&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I mentioned in a <a title="PHP jQuery Cookbook" href="http://www.vijayjoshi.org/2010/11/22/guys-i-am-writing-a-book/">previous post</a> that I was writing a book on PHP and jQuery. Well, after a labor of around 7 months the book is out now. It is available on <a title="PHP jQuery Cookbook on Packt" href="http://goo.gl/WlFX">Packt website</a> as well as <a title="PHP jQuery Cookbook on Amazon" href="http://www.amazon.com/PHP-jQuery-Cookbook-Vijay-Joshi/dp/1849512744/">Amazon</a>.</p>
<p>Meanwhile, to help you make a decision, a sample chapter from the book is available on Packt website. The chapter is Working with JSON in PHP and jQuery and it contains 4 articles that explain creating, reading and writing JSON in PHP as well as jQuery.</p>
<p>Below are the topics that this chapter covers:</p>
<ul>
<li>Creating JSON in PHP</li>
<li>Reading JSON in PHP</li>
<li>Catching JSON parsing errors</li>
<li>Accessing data from a JSON in jQuery</li>
</ul>
<p>To read the full chapter, just follow this link <a title="Working with JSON in PHP jQuery" href="http://www.packtpub.com/article/working-json-php-jquery">http://www.packtpub.com/article/working-json-php-jquery</a></p>
<div class="shr-publisher-853"></div><!-- Start Shareaholic LikeButtonSetBottom --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:right;height:30px;'><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.vijayjoshi.org%2F2010%2F12%2F20%2Fworking-with-json-in-php-and-jquery%2F' data-shr_title='Working+with+JSON+in+PHP+and+jQuery'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom -->]]></content:encoded>
			<wfw:commentRss>http://www.vijayjoshi.org/2010/12/20/working-with-json-in-php-and-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Guys, I am writing a book</title>
		<link>http://www.vijayjoshi.org/2010/11/22/guys-i-am-writing-a-book/</link>
		<comments>http://www.vijayjoshi.org/2010/11/22/guys-i-am-writing-a-book/#comments</comments>
		<pubDate>Mon, 22 Nov 2010 11:25:08 +0000</pubDate>
		<dc:creator>Vijay Joshi</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Resources]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.vijayjoshi.org/?p=671</guid>
		<description><![CDATA[
			
				
			
		

Yes that&#8217;s right and it is called PHP jQuery Cookbook.  As the name suggests, it&#8217;s about creating rich internet applications using 2 of my favorite technologies &#8211; PHP and jQuery.
I love coding web apps and helping others find solutions. Perhaps that is the reason I agreed to write when the wonderful people at Packt Publishing contacted me. (Also, a book ...]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop --><!-- End Shareaholic LikeButtonSetTop --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2010%2F11%2F22%2Fguys-i-am-writing-a-book%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2010%2F11%2F22%2Fguys-i-am-writing-a-book%2F&amp;source=v08i&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-630" title="PHP jQuery Cookbook" src="http://www.vijayjoshi.org/wp-content/uploads/2749OS_MockupCover_Cookbook_0.jpg" alt="PHP jQuery Cookbook" width="320" height="395" /></p>
<p>Yes that&#8217;s right and it is called <strong><a title="PHP jQuery Cookbook" href="https://www.packtpub.com/php-jquery-cookbook-to-create-interactive-web-applications/book">PHP jQuery Cookbook</a></strong>.  As the name suggests, it&#8217;s about creating rich internet applications using 2 of my favorite technologies &#8211; PHP and jQuery.</p>
<p>I love coding web apps and helping others find solutions. Perhaps that is the reason I agreed to write when the wonderful people at <a title="Packt Publishing" href="http://www.packtpub.com/">Packt Publishing</a> contacted me. (Also, a book on resume isn&#8217;t that bad either <img src='http://www.vijayjoshi.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> )</p>
<p>Another reason is I love Open source. It is a lovely philosophy and I am a strong believer in it. Having learnt so much from the Open source community since I started coding, I have always wanted to return something back. Nothing could have been better then this. And did I mention, Packt pays <a title="Packt Open Source Royalties" href="http://authors.packtpub.com/content/open-source-royalties">direct royalty to a project</a> if they sell a book written on the same.</p>
<p><strong><span id="more-671"></span></strong></p>
<p>Long story short, the book is cookbook with around 65 recipes covering PHP, jQuery, MySql and some API&#8217;s (Flickr, Youtube).</p>
<p>Structure wise, it has 10 chapters in all.</p>
<ul>
<li>Handling Events</li>
<li>Combining PHP and jQuery</li>
<li>Working with XML documents</li>
<li>Working with JSON</li>
<li>Working with Forms</li>
<li>Adding Visual effects to forms</li>
<li>Creating cool Navigation Menus</li>
<li>Data binding with PHP and jQuery</li>
<li>Enhancing your site with PHP and jQuery</li>
<li>Appendix &#8211; FireBug</li>
</ul>
<p>The book is available now <span style="text-decoration: line-through;">will be available by 14th December</span> <del datetime="2010-12-01T06:28:41+00:00">Christmas this year or January next year</del>. You can have a look in detail about what it is all about on Packt Website. Order a copy in case you find it interesting <img src='http://www.vijayjoshi.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<div class="shr-publisher-671"></div><!-- Start Shareaholic LikeButtonSetBottom --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:right;height:30px;'><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.vijayjoshi.org%2F2010%2F11%2F22%2Fguys-i-am-writing-a-book%2F' data-shr_title='Guys%2C+I+am+writing+a+book'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom -->]]></content:encoded>
			<wfw:commentRss>http://www.vijayjoshi.org/2010/11/22/guys-i-am-writing-a-book/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

