<?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</title>
	<atom:link href="http://www.vijayjoshi.org/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>Comment box not visible on a page/post in WordPress 3.2.1</title>
		<link>http://www.vijayjoshi.org/2011/10/21/comment-box-not-visible-on-a-pagepost-in-wordpress-3-2-1/</link>
		<comments>http://www.vijayjoshi.org/2011/10/21/comment-box-not-visible-on-a-pagepost-in-wordpress-3-2-1/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 11:09:22 +0000</pubDate>
		<dc:creator>Vijay Joshi</dc:creator>
				<category><![CDATA[FAQ]]></category>

		<guid isPermaLink="false">http://www.vijayjoshi.org/?p=1312</guid>
		<description><![CDATA[
			
				
			
		
First of all I will congratulate you on upgrading to wordpress 3.2.1. Having latest version means your site is updated and safe.
Now coming to the point, some of you might have faced this problem. You create a new page or post and do not want to allow comments on that. So you scroll down but cannot find the discussion box. ...]]></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%2F10%2F21%2Fcomment-box-not-visible-on-a-pagepost-in-wordpress-3-2-1%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F10%2F21%2Fcomment-box-not-visible-on-a-pagepost-in-wordpress-3-2-1%2F&amp;source=v08i&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>First of all I will congratulate you on upgrading to wordpress 3.2.1. Having latest version means your site is updated and safe.</p>
<p>Now coming to the point, some of you might have faced this problem. You create a new page or post and do not want to allow comments on that. So you scroll down but cannot find the discussion box. The box which has 2 checkboxes &#8220;Allow comments&#8221; and &#8220;Allow trackbacks and pingbacks&#8221;.</p>
<p>To fix this, look at the top right of your screen for the <strong>Screen Options</strong> button. Click that and you will see a lot of checkboxes there. Click the <strong>Discussion</strong>  checkbox and close the screen options. Now scroll to bottom of the page and you will find the box sitting there.</p>
<p><a href="http://www.vijayjoshi.org/wp-content/uploads/wp-comments.png"><img class="aligncenter size-full wp-image-1313" title="wp-comments" src="http://www.vijayjoshi.org/wp-content/uploads/wp-comments.png" alt="Enable comments" width="656" height="268" /></a></p>
<p>WP3.2.1 has several other options like Custom fields, slug, Author which you can also enable from here.</p>
<div class="shr-publisher-1312"></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%2F10%2F21%2Fcomment-box-not-visible-on-a-pagepost-in-wordpress-3-2-1%2F' data-shr_title='Comment+box+not+visible+on+a+page%2Fpost+in+Wordpress+3.2.1'></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/10/21/comment-box-not-visible-on-a-pagepost-in-wordpress-3-2-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<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>Book Review: Mastering phpMyAdmin 3.3.x for Effective MySQL Management</title>
		<link>http://www.vijayjoshi.org/2011/02/10/book-review-mastering-phpmyadmin-3-3-x-for-effective-mysql-management/</link>
		<comments>http://www.vijayjoshi.org/2011/02/10/book-review-mastering-phpmyadmin-3-3-x-for-effective-mysql-management/#comments</comments>
		<pubDate>Thu, 10 Feb 2011 05:46:15 +0000</pubDate>
		<dc:creator>Vijay Joshi</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.vijayjoshi.org/?p=1200</guid>
		<description><![CDATA[
			
				
			
		
Recently I was contacted by Richard from Packt Publication to review their new book &#8220;Mastering phpMyAdmin 3.3.x for Effective MySQL Management&#8220;. Being a PHP-MySQL developer and an avid reader of technical books myself, I instantly agreed.
It took me a bit longer to read it then I had expected. At first, I had decided to just skim through the important chapters ...]]></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%2F02%2F10%2Fbook-review-mastering-phpmyadmin-3-3-x-for-effective-mysql-management%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F02%2F10%2Fbook-review-mastering-phpmyadmin-3-3-x-for-effective-mysql-management%2F&amp;source=v08i&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Recently I was contacted by Richard from Packt Publication to review their new book &#8220;<strong><a title="phpMyAdmin Book" href="http://link.packtpub.com/K5JQ8I" target="_blank">Mastering phpMyAdmin 3.3.x for Effective MySQL Management</a></strong>&#8220;. Being a PHP-MySQL developer and an avid reader of technical books myself, I instantly agreed.</p>
<p>It took me a bit longer to read it then I had expected. At first, I had decided to just skim through the important chapters but it was interesting enough to change my decision. I then read all chapters one by one and realized that despite using phpMyAdmin on a daily basis, there is so much more to it that we developers are unaware of.</p>
<p>The author of this book is <strong>Marc Delisle</strong>, who is contributing to this project for more then 12 years. The book contains 19 chapters and 2 appendices. In my opinion the book can be divided broadly into 5 parts.</p>
<p style="text-align: center;"><a href="http://link.packtpub.com/K5JQ8I" target="_blank"><img class="aligncenter" title="Mastering phpMyAdmin 3.3x for Effective MySQL Management" src="https://www.packtpub.com/sites/default/files/3548OS_MockupCover.jpg" alt="" width="315" height="389" /></a></p>
<p><strong>Chapter 1 to Chapter 3</strong><br />
I will say these warm up chapters as they cover installation, configuration and overview of phpMyAdmin interface in detail. Experienced users may skip these but beginners should go through each one of them.</p>
<p><span id="more-1200"></span></p>
<p><strong>Chapter 4 to Chapter 7</strong><br />
These 4 chapters explain through data management i.e. creating database and table structures and import/export of data.</p>
<p><strong>Chapter 8 to Chapter 12</strong><br />
You will find all information on querying tables(including multiple table queries), table and database operations, creating relations and keys etc. I liked these chapters the most.</p>
<p><strong>Chapter 13 to Chapter 15</strong><br />
These chapters cover data synchronization, bookmarking and generation of printable reports and schemas from phpMyAdmin. Very useful chapters indeed, in case you want to synchronize data between 2 servers or you want the schemas printed or available in pdf format.</p>
<p><strong>Chapter 16 to Chapter 19</strong><br />
Chapters for advanced and experienced users, these explain data transformation, creating views, stored procedures, executing triggers etc. Chapter 18 is specifically for versioning and tracking database changes. Final chapter is all about administering the MySQL server with phpMyAdmin. All of these chapters are extremely useful.</p>
<p><strong>Conclusion</strong></p>
<p>Each chapter is explained in a detailed manner which sometimes seems too much, but thats my perspective, someone who has been using phpMyAdmin for more then 5-6 years now. Beginner and intermediate users will find those details useful and easy to understand.</p>
<p>Overall, I liked the book and learned about few things I did not know even existed. I will definitely recommend it. For new users of phpMyAdmin, it starts from beginner level and explains each task by breaking it down in steps. More advanced users may skip initial 5-6 chapters but later chapters will be definitely helpful for them.</p>
<p>You can see more details on this book at Packt&#8217;s website at <a title="phpMyAdmin Book" href="http://link.packtpub.com/K5JQ8I">this link</a> and buy at either Packt website or amazon.</p>
<div class="shr-publisher-1200"></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%2F02%2F10%2Fbook-review-mastering-phpmyadmin-3-3-x-for-effective-mysql-management%2F' data-shr_title='Book+Review%3A+Mastering+phpMyAdmin+3.3.x+for+Effective+MySQL+Management'></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/02/10/book-review-mastering-phpmyadmin-3-3-x-for-effective-mysql-management/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Favorite tech links of the week : 17 Jan – 23 Jan, 2011</title>
		<link>http://www.vijayjoshi.org/2011/01/24/favorite-tech-links-of-the-week-17-jan23-jan-2011/</link>
		<comments>http://www.vijayjoshi.org/2011/01/24/favorite-tech-links-of-the-week-17-jan23-jan-2011/#comments</comments>
		<pubDate>Mon, 24 Jan 2011 06:09:00 +0000</pubDate>
		<dc:creator>Vijay Joshi</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.vijayjoshi.org/?p=1169</guid>
		<description><![CDATA[
			
				
			
		
This post contains some of the useful and interesting tech links I found during last week. To keep up to date with the latest information, subscribe to the feed or follow me on twitter @v08i.
How to write a simple application on jQuery Mobile : http://goo.gl/5DpOO

50 Free Tools and Apps for Web Designers and Developers : http://goo.gl/6YjNL

10 Useful jQuery Plugins for Images : ...]]></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%2F24%2Ffavorite-tech-links-of-the-week-17-jan23-jan-2011%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F24%2Ffavorite-tech-links-of-the-week-17-jan23-jan-2011%2F&amp;source=v08i&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>This post contains some of the useful and interesting tech links I found during last week. To keep up to date with the latest information, <a title="Subscribe" href="http://vijayjoshi.org/feed">subscribe to the feed</a> or follow me on twitter <a title="Follow me on Twitter" href="http://twitter.com/v08i">@v08i</a>.</p>
<h4>How to write a simple application on jQuery Mobile : <a href="http://goo.gl/526cL">http://goo.gl/5DpOO</a></h4>
<p style="text-align: center;"><a href="http://goo.gl/526cL"><img class="aligncenter size-full wp-image-1170" title="jQuery Mobile" src="http://www.vijayjoshi.org/wp-content/uploads/jQueryMobile.png" alt="jQuery Mobile" /></a></p>
<h4>50 Free Tools and Apps for Web Designers and Developers : <a href="http://goo.gl/6YjNL">http://goo.gl/6YjNL</a></h4>
<p style="text-align: center;"><a href="http://goo.gl/6YjNL"><img class="aligncenter size-full wp-image-1171" title="50 Free tools for developers" src="http://www.vijayjoshi.org/wp-content/uploads/50tools.png" alt="50 Free tools for developers" width="527" height="194" /></a></p>
<h4>10 Useful jQuery Plugins for Images : <a href="http://goo.gl/VTk1F">http://goo.gl/VTk1F</a></h4>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-1172" title="jQuery Image Tools" src="http://www.vijayjoshi.org/wp-content/uploads/jQueryFaceDetection.png" alt="jQuery Image Tools" width="484" height="321" /></p>
<h4>20 less known Open Source PHP CMS-es : <a href="http://goo.gl/cM6f3">http://goo.gl/cM6f3</a></h4>
<p style="text-align: center;"><a href="http://goo.gl/cM6f3"><img class="aligncenter size-full wp-image-1173" title="php Cms" src="http://www.vijayjoshi.org/wp-content/uploads/phpCmses.png" alt="php Cms" width="494" height="372" /></a></p>
<h4>11 More Things I Learned From the jQuery Source : <a href="http://goo.gl/2zBh7">http://goo.gl/2zBh7</a></h4>
<p style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="350" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/ARnp9Y8xgR4" /><embed type="application/x-shockwave-flash" width="425" height="350" src="http://www.youtube.com/v/ARnp9Y8xgR4"></embed></object></p>
<h4>CSSReset : All the most common CSS Reset scripts in one place : <a href="http://goo.gl/8OV9E">http://goo.gl/8OV9E</a></h4>
<p style="text-align: center;"><a href="http://goo.gl/8OV9E"><img class="aligncenter size-full wp-image-1174" title="CSS Resets" src="http://www.vijayjoshi.org/wp-content/uploads/CSSResets.png" alt="CSS Resets" width="508" height="413" /></a></p>
<h4>JavaScript Slider – TinySlider 2 : <a href="http://goo.gl/526cL">http://goo.gl/526cL</a></h4>
<p style="text-align: center;"><a href="http://goo.gl/526cL"><img class="aligncenter size-full wp-image-1175" title="js Slider" src="http://www.vijayjoshi.org/wp-content/uploads/jsSlider.png" alt="js Slider" width="482" height="193" /></a></p>
<div class="shr-publisher-1169"></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%2F24%2Ffavorite-tech-links-of-the-week-17-jan23-jan-2011%2F' data-shr_title='Favorite+tech+links+of+the+week+%3A+17+Jan+%E2%80%93+23+Jan%2C+2011'></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/24/favorite-tech-links-of-the-week-17-jan23-jan-2011/feed/</wfw:commentRss>
		<slash:comments>1</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>15 HTML5 resources and tutorials for web developers and designers</title>
		<link>http://www.vijayjoshi.org/2011/01/20/15-html5-resources-and-tutorials-for-web-developers-and-designers/</link>
		<comments>http://www.vijayjoshi.org/2011/01/20/15-html5-resources-and-tutorials-for-web-developers-and-designers/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 09:26:54 +0000</pubDate>
		<dc:creator>Vijay Joshi</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[Web2.0]]></category>

		<guid isPermaLink="false">http://www.vijayjoshi.org/?p=1126</guid>
		<description><![CDATA[
			
				
			
		
Here is a collection of 15 resources on HTML5 that I think will be useful to web developers as well as designers.
What is HTML5? (Infographic)

Dive Into HTML5

HTML 5 Demos and Examples

HTML5   Boilerplate :A rock-solid default for HTML5 awesome


HTML 5 Cheat Sheet (PDF)

28 HTML5 Features, Tips, and Techniques you Must Know

A Beginners Look Into HTML5

15 Easy Guides on Getting ...]]></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%2F20%2F15-html5-resources-and-tutorials-for-web-developers-and-designers%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F20%2F15-html5-resources-and-tutorials-for-web-developers-and-designers%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 collection of 15 resources on HTML5 that I think will be useful to web developers as well as designers.</p>
<h4><a href="http://www.focus.com/images/view/11905/">What is HTML5? (Infographic)</a></h4>
<p><a href="http://www.focus.com/images/view/11905/"><img class="aligncenter size-full wp-image-1127" title="What Is HTML5" src="http://www.vijayjoshi.org/wp-content/uploads/WhatIsHTML5.png" alt="What Is HTML5" /></a></p>
<h4><a href="http://diveintohtml5.org/">Dive Into HTML5</a></h4>
<p style="text-align: center;"><a href="http://diveintohtml5.org/"><img class="aligncenter size-full wp-image-1128" title="dive into html5" src="http://www.vijayjoshi.org/wp-content/uploads/diveintohtml5.png" alt="dive into html5" width="424" height="323" /></a></p>
<h4><a href="http://html5demos.com/">HTML 5 Demos and Examples</a></h4>
<p style="text-align: center;"><a href="http://html5demos.com/"><img class="aligncenter size-full wp-image-1129" title="html5 demos" src="http://www.vijayjoshi.org/wp-content/uploads/html5demos.png" alt="html5 demos" width="460" height="399" /></a></p>
<h4><a href="http://html5boilerplate.com/">HTML5   Boilerplate :A rock-solid default for HTML5 awesome</a></h4>
<p style="text-align: center;"><a href="http://html5boilerplate.com/"><img class="aligncenter size-full wp-image-1130" title="html5 boilerplate" src="http://www.vijayjoshi.org/wp-content/uploads/html5boilerplate.png" alt="html5 boilerplate" width="453" height="154" /></a></p>
<p><strong><span id="more-1126"></span></strong></p>
<h4><a href="http://www.smashingmagazine.com/2009/07/06/html-5-cheat-sheet-pdf/">HTML 5 Cheat Sheet (PDF)</a></h4>
<p><a href="http://www.smashingmagazine.com/2009/07/06/html-5-cheat-sheet-pdf/"><img class="aligncenter size-full wp-image-1131" title="html5 cheat sheet" src="http://www.vijayjoshi.org/wp-content/uploads/html5cheatsheet.gif" alt="html5 cheat sheet" /></a></p>
<h4><a href="http://net.tutsplus.com/tutorials/html-css-techniques/25-html5-features-tips-and-techniques-you-must-know/">28 HTML5 Features, Tips, and Techniques you Must Know</a></h4>
<p style="text-align: center;"><a href="http://net.tutsplus.com/tutorials/html-css-techniques/25-html5-features-tips-and-techniques-you-must-know/"><img class="aligncenter size-full wp-image-1132" title="28 Tips and features" src="http://www.vijayjoshi.org/wp-content/uploads/28Tips.png" alt="28 Tips and features" width="463" height="174" /></a></p>
<h4><a href="http://www.testking.com/techking/web-design/a-beginners-look-into-html5/">A Beginners Look Into HTML5</a></h4>
<p style="text-align: center;"><a href="http://www.testking.com/techking/web-design/a-beginners-look-into-html5/"><img class="aligncenter size-full wp-image-1133" title="html5 for beginners" src="http://www.vijayjoshi.org/wp-content/uploads/html5forbeginners.png" alt="html5 for beginners" width="487" height="160" /></a></p>
<h4><a href="http://webdesigneraid.com/15-easy-guides-on-getting-you-started-with-html5/">15 Easy Guides on Getting You Started with HTML5</a></h4>
<h4><a href="http://webdesignledger.com/inspiration/35-inspiring-examples-of-websites-using-html5">35 Inspiring Examples of Websites Using HTML5</a></h4>
<p style="text-align: center;"><a href="http://webdesignledger.com/inspiration/35-inspiring-examples-of-websites-using-html5"><img class="size-full wp-image-1134 aligncenter" title="35 html5 examples" src="http://www.vijayjoshi.org/wp-content/uploads/35examples.png" alt="35 html5 examples" width="430" height="268" /></a></p>
<h4><a href="http://www.impressivewebs.com/html5-section/">When to Use the HTML5 “section” Element</a></h4>
<p style="text-align: center;"><a href="http://www.impressivewebs.com/html5-section/"><img class="aligncenter size-full wp-image-1135" title="HTML5 section" src="http://www.vijayjoshi.org/wp-content/uploads/HTML5section.png" alt="HTML5 section" width="443" height="142" /></a></p>
<h4><a href="http://blogs.sitepoint.com/2011/01/18/dont-forget-about-html5s-little-guys/">Don’t Forget About HTML5’s “Little Guys”</a></h4>
<p style="text-align: center;"><a href="http://blogs.sitepoint.com/2011/01/18/dont-forget-about-html5s-little-guys/"><img class="aligncenter size-full wp-image-1136" title="html5 small" src="http://www.vijayjoshi.org/wp-content/uploads/html5small.png" alt="html5 small" width="494" height="146" /></a></p>
<h4><a href="http://net.tutsplus.com/tutorials/html-css-techniques/how-to-build-cross-browser-html5-forms/">How to Build Cross-Browser HTML5 Forms</a></h4>
<p style="text-align: center;"><a href="http://net.tutsplus.com/tutorials/html-css-techniques/how-to-build-cross-browser-html5-forms/"><img class="aligncenter size-full wp-image-1137" title="HTML5 cross browser forms" src="http://www.vijayjoshi.org/wp-content/uploads/crossbrowserforms.png" alt="HTML5 cross browser forms" width="434" height="329" /></a></p>
<h4><a href="http://html5gallery.com/">HTML5 Gallery &#8211; A showcase of sites using HTML5 markup</a></h4>
<p><a href="http://html5gallery.com/"><img class="aligncenter size-full wp-image-1138" title="html5 gallery" src="http://www.vijayjoshi.org/wp-content/uploads/html5gallery.png" alt="html5 gallery" /></a></p>
<h4><a href="http://ntt.cc/2010/06/03/30-useful-html5-tutorials-for-web-designers.html">30+ Useful HTML5 Tutorials For Web Designers</a></h4>
<p><a href="http://ntt.cc/2010/06/03/30-useful-html5-tutorials-for-web-designers.html"><img class="aligncenter size-full wp-image-1139" title="30 HTML5 Tutorials" src="http://www.vijayjoshi.org/wp-content/uploads/30HTML5Tutorials.png" alt="30 HTML5 Tutorials" /></a></p>
<h4><a href="http://html5doctor.com/">HTML5 Doctor</a></h4>
<p style="text-align: center;"><a href="http://html5doctor.com/"><img class="aligncenter size-full wp-image-1140" title="html5 Doctor" src="http://www.vijayjoshi.org/wp-content/uploads/html5Doctor.png" alt="html5 Doctor" width="512" height="320" /></a></p>
<div class="shr-publisher-1126"></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%2F20%2F15-html5-resources-and-tutorials-for-web-developers-and-designers%2F' data-shr_title='15+HTML5+resources+and+tutorials+for+web+developers+and+designers'></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/20/15-html5-resources-and-tutorials-for-web-developers-and-designers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Favorite tech links of the week : 10 Jan – 16 Jan, 2011</title>
		<link>http://www.vijayjoshi.org/2011/01/17/favorite-tech-links-of-the-week-10-jan-%e2%80%93-16-jan-2011/</link>
		<comments>http://www.vijayjoshi.org/2011/01/17/favorite-tech-links-of-the-week-10-jan-%e2%80%93-16-jan-2011/#comments</comments>
		<pubDate>Mon, 17 Jan 2011 07:02:07 +0000</pubDate>
		<dc:creator>Vijay Joshi</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.vijayjoshi.org/?p=1110</guid>
		<description><![CDATA[
			
				
			
		
This post contains some of the useful and interesting tech links I found during this week. To keep up to date with the latest information, subscribe to the feed or follow me on twitter @v08i
22 Brilliant and Advanced jQuery Effects to WOW Your Visitors &#8211; http://goo.gl/IUz3d


12 Cool Javascript – jQuery checkbox replacement you shouldn’t miss &#8211; http://goo.gl/4OxcT


70 Must See CSS3 Tips, Tricks ...]]></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%2F17%2Ffavorite-tech-links-of-the-week-10-jan-%25e2%2580%2593-16-jan-2011%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2011%2F01%2F17%2Ffavorite-tech-links-of-the-week-10-jan-%25e2%2580%2593-16-jan-2011%2F&amp;source=v08i&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>This post contains some of the useful and interesting tech links I found during this week. To keep up to date with the latest information, <a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-weight: inherit; font-style: inherit; font-size: 14px; font-family: inherit; vertical-align: baseline; color: #00a1c9; text-decoration: none; padding: 0px; margin: 0px; border: 0px initial initial;" title="Subscribe" href="http://vijayjoshi.org/feed">subscribe to the feed</a> or follow me on twitter <a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-weight: inherit; font-style: inherit; font-size: 14px; font-family: inherit; vertical-align: baseline; color: #00a1c9; text-decoration: none; padding: 0px; margin: 0px; border: 0px initial initial;" title="Follow me on Twitter" href="http://twitter.com/v08i">@v08i</a></p>
<h4>22 Brilliant and Advanced jQuery Effects to WOW Your Visitors &#8211; <a href="http://goo.gl/IUz3d">http://goo.gl/IUz3d</a></h4>
<p style="text-align: center;"><a href="http://goo.gl/IUz3d"><img class="aligncenter size-full wp-image-1111" title="22 jQuery Effects" src="http://www.vijayjoshi.org/wp-content/uploads/22jQueryEffects.png" alt="22 jQuery Effects" width="465" height="318" /></a></p>
<h4></h4>
<h4>12 Cool Javascript – jQuery checkbox replacement you shouldn’t miss &#8211; <a href="http://goo.gl/4OxcT">http://goo.gl/4OxcT</a></h4>
<p style="text-align: center;"><a href="http://goo.gl/4OxcT"><img class="aligncenter size-full wp-image-1112" title="12 jQuery Checkboxes" src="http://www.vijayjoshi.org/wp-content/uploads/12jQueryCheckboxes.png" alt="12 jQuery Checkboxes" width="466" height="115" /></a></p>
<h4></h4>
<h4>70 Must See CSS3 Tips, Tricks And Tutorials &#8211; <a href="http://goo.gl/VarE4">http://goo.gl/VarE4</a></h4>
<p><a href="http://goo.gl/VarE4"><img class="aligncenter size-full wp-image-1113" title="70 Css Tricks" src="http://www.vijayjoshi.org/wp-content/uploads/70CssTricks.png" alt="70 Css Tricks" /></a></p>
<h4></h4>
<h4>The anatomy of a WordPress theme &#8211; <a href="http://goo.gl/CCdLH">http://goo.gl/CCdLH</a></h4>
<p style="text-align: center;"><a href="http://goo.gl/CCdLH"><img class="aligncenter size-full wp-image-1114" title="Wordpress Theme" src="http://www.vijayjoshi.org/wp-content/uploads/WordpressTheme.png" alt="Wordpress Theme" width="492" height="326" /></a></p>
<h4>Google URL Shortener API &#8211; <a href="http://goo.gl/Ia1fl">http://goo.gl/Ia1fl</a></h4>
<p style="text-align: center;"><a href="http://goo.gl/Ia1fl"><img class="aligncenter size-full wp-image-1115" title="url Shortener" src="http://www.vijayjoshi.org/wp-content/uploads/urlShortener.png" alt="url Shortener" width="454" height="134" /></a></p>
<h4>DOM Monster &#8211; <a href="http://goo.gl/nGySG">http://goo.gl/nGySG</a></h4>
<p style="text-align: center;"><a href="http://goo.gl/nGySG"><img class="aligncenter size-full wp-image-1116" title="Dom Monster" src="http://www.vijayjoshi.org/wp-content/uploads/DomMonster.png" alt="Dom Monster" width="545" height="155" /></a></p>
<h4>Why You Should Never Search For Free WordPress Themes in Google or Anywhere Else &#8211; <a href="http://goo.gl/QSzTE">http://goo.gl/QSzTE</a></h4>
<p style="text-align: center;"><a href="http://goo.gl/QSzTE"><img class="aligncenter size-full wp-image-1117" title="WP Theme" src="http://www.vijayjoshi.org/wp-content/uploads/WPTheme.png" alt="WP Theme" width="465" height="204" /></a></p>
<h4>45 Cheat-Sheet Desktop Wallpaper For Web Designers and Developers &#8211; <a href="http://goo.gl/u1VT9">http://goo.gl/u1VT9</a></h4>
<p style="text-align: center;"><a href="http://goo.gl/u1VT9"><img class="aligncenter size-full wp-image-1118" title="45 Cheat Sheets" src="http://www.vijayjoshi.org/wp-content/uploads/45CheatSheets.png" alt="45 Cheat Sheets" width="528" height="465" /></a></p>
<h4>What Makes a Good Website &#8211; <a href="http://goo.gl/Ua9ZW">http://goo.gl/Ua9ZW</a></h4>
<p style="text-align: center;"><a href="http://goo.gl/Ua9ZW"><img class="aligncenter size-full wp-image-1119" title="Good Website" src="http://www.vijayjoshi.org/wp-content/uploads/GoodWebsite.png" alt="Good Website" width="497" height="264" /></a></p>
<h4>Listamatic &#8211; various types of lists with ul and CSS &#8211; <a href="http://goo.gl/EzlcX">http://goo.gl/EzlcX</a></h4>
<p><a href="http://goo.gl/EzlcX"><img class="aligncenter size-full wp-image-1120" title="Various Lists" src="http://www.vijayjoshi.org/wp-content/uploads/VariousLists.png" alt="Various Lists" /></a></p>
<div class="shr-publisher-1110"></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%2F17%2Ffavorite-tech-links-of-the-week-10-jan-%25e2%2580%2593-16-jan-2011%2F' data-shr_title='Favorite+tech+links+of+the+week+%3A+10+Jan+%E2%80%93+16+Jan%2C+2011'></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/17/favorite-tech-links-of-the-week-10-jan-%e2%80%93-16-jan-2011/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>
	</channel>
</rss>

<!-- Dynamic page generated in 0.572 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-02-05 01:42:35 -->

