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

<channel>
	<title>PHP Tutorials</title>
	<atom:link href="http://phpcollection.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://phpcollection.com</link>
	<description>PHP Tutorials collection</description>
	<lastBuildDate>Tue, 12 Jul 2011 11:53:27 +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>Google Plus API</title>
		<link>http://phpcollection.com/google-plus-api/</link>
		<comments>http://phpcollection.com/google-plus-api/#comments</comments>
		<pubDate>Sun, 10 Jul 2011 01:50:01 +0000</pubDate>
		<dc:creator>Learn PHP</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[Google plus]]></category>
		<category><![CDATA[plus API]]></category>

		<guid isPermaLink="false">http://phpcollection.com/?p=792</guid>
		<description><![CDATA[Google is rolling out API very soon for developers to take a sneak peak and develop applications. In the meantime developers can sign up at https://services.google.com/fb/forms/plusdevelopers/ to get a early access onto the Google plus API. Eventually, google plus is playing a invite only for brands and developers too after a successful stunt with social [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Google is rolling out API very soon for developers to take a sneak peak and develop applications. In the meantime developers can sign up at https://services.google.com/fb/forms/plusdevelopers/ to get a early access onto the Google plus API.</p>
<p>Eventually, google plus is playing a invite only for brands and developers too after a successful stunt with social networking users all around the world. Brands can sign up here http://goo.gl/zq95C to be the first to get listed as business on Google+.</p>
]]></content:encoded>
			<wfw:commentRss>http://phpcollection.com/google-plus-api/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ERROR:  While executing gem (Gem::RemoteSourceException)  HTTP Response 302 fetching</title>
		<link>http://phpcollection.com/error-while-executing-gem-gemremotesourceexception-http-response-302-fetching/</link>
		<comments>http://phpcollection.com/error-while-executing-gem-gemremotesourceexception-http-response-302-fetching/#comments</comments>
		<pubDate>Sun, 10 Jul 2011 01:40:29 +0000</pubDate>
		<dc:creator>Learn PHP</dc:creator>
				<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[gem exception]]></category>
		<category><![CDATA[ROR]]></category>
		<category><![CDATA[ruby on rails error]]></category>
		<category><![CDATA[source ruby]]></category>

		<guid isPermaLink="false">http://phpcollection.com/?p=790</guid>
		<description><![CDATA[While struggling with old gems and ruby installation on my macosx. I googled a lot for response and find no satisfactory answer. The problem was simple, macosx 10.5 comes with ruby 1.8.1 and rails 1.2.6 which is now a depreciated version of ROR and not recommended to be used for production. Now since gems have [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>While struggling with old gems and ruby installation on my macosx. I googled a lot for response and find no satisfactory answer.</p>
<p>The problem was simple, macosx 10.5 comes with ruby 1.8.1 and rails 1.2.6 which is now a depreciated version of ROR and not recommended to be used for production.</p>
<p>Now since gems have moved there base, every gem install command was throwing a 302 HTTP error.</p>
<pre>
$ sudo gem install rails
ERROR:  While executing gem ... (Gem::RemoteSourceException)
    HTTP Response 302 fetching http://gems.rubyforge.org/yaml
</pre>
<p>Even the most suggested resolution which is a gem update didn&#8217;t work.</p>
<pre>
gaurav-mishras-macbook:rubygems-1.8.5 gaurav$ sudo gem update --system
Updating RubyGems...
ERROR:  While executing gem ... (Gem::RemoteSourceException)
    HTTP Response 302 fetching http://gems.rubyforge.org/yaml
</pre>
<p>Then luckily a landed to a blog post which mentioned a similar problem and changing the source of the gem repositry worked like charm. Just add  &#8211;source http://production.s3.rubygems.org</p>
<p>For example</p>
<pre>
gaurav-mishras-macbook:rubygems-1.8.5 gaurav$ sudo gem update --system --source http://production.s3.rubygems.org
Updating RubyGems...
</pre>
]]></content:encoded>
			<wfw:commentRss>http://phpcollection.com/error-while-executing-gem-gemremotesourceexception-http-response-302-fetching/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>2 most common php url functions for daily use</title>
		<link>http://phpcollection.com/php-url/</link>
		<comments>http://phpcollection.com/php-url/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 14:00:44 +0000</pubDate>
		<dc:creator>Learn PHP</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://phpcollection.com/?p=773</guid>
		<description><![CDATA[Seldom every php developer need some php url functions to work with , usually while parsing a web portal or finding the links url functions come very handy. Here are URL based functionalities a developer may need . 1) Get the url of the portal:- echo $_SERVER('HTTP_HOST'); 2) Parse the url for extracting all components:- [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Seldom every php developer need some php url functions to work with , usually while parsing a web portal or finding the links url functions come very handy.</p>
<p>Here are URL based functionalities a developer may need .</p>
<p>1) Get the url of the portal:-</p>
<pre class="php">

echo $_SERVER('HTTP_HOST');
</pre>
<p>2) Parse the url for extracting all components:-</p>
<pre class="php">

$url_demo = 'http://user:pass@host/path?arg=val';

print_r(parse_url($url_demo));
</pre>
<p>Hope these handy code snippets would help you to save time for URL formatting in PHP.</p>
]]></content:encoded>
			<wfw:commentRss>http://phpcollection.com/php-url/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Plus Circles</title>
		<link>http://phpcollection.com/google-circle/</link>
		<comments>http://phpcollection.com/google-circle/#comments</comments>
		<pubDate>Sun, 13 Mar 2011 16:10:22 +0000</pubDate>
		<dc:creator>Learn PHP</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[Google Circles]]></category>
		<category><![CDATA[Google Circles API]]></category>

		<guid isPermaLink="false">http://phpcollection.com/?p=781</guid>
		<description><![CDATA[Update:- Google launched the google circle social network as Google plus. API is still awaited. Updates will be coming as the API gets launched. Google is launching there new social networking service &#8220;Google Circles&#8221;, this is rumored to offer photo sharing, video sharing and updates. Which can be tightly linked to other social networks and [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Update:- Google launched the google circle social network as Google plus. API is still awaited. Updates will be coming as the API gets launched.</p>
<p>Google is launching there new social networking service &#8220;Google Circles&#8221;, this is rumored to offer photo sharing, video sharing and updates. Which can be tightly linked to other social networks and circles. This news was broken by Read Write web today from #sxsw.</p>
<p>We wonder where buzz will fit into this and since this will be google product we are very excited to see what API details it will offer. We promise our readers to update with every bit of details, when there API announcement comes out.</p>
]]></content:encoded>
			<wfw:commentRss>http://phpcollection.com/google-circle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter bot tutorial</title>
		<link>http://phpcollection.com/twitter-bot/</link>
		<comments>http://phpcollection.com/twitter-bot/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 12:37:16 +0000</pubDate>
		<dc:creator>Php Ninza</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[Bot]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.phpcollection.com/?p=550</guid>
		<description><![CDATA[Twitter is heavily becoming a source of traffic and with there extremely powerful api , it&#8217;s very easy to automate stuff via Twitter bots. Today i am going to show you a tutorial for very simple but yet very powerful bot which if used effectively can drive great traffic on sites. These bots simply search [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Twitter is heavily becoming a source of traffic and with there extremely powerful api , it&#8217;s very easy to automate stuff via Twitter bots.</p>
<p>Today i am going to show you a tutorial for very simple but yet very powerful bot which if used effectively can drive great traffic on sites. These bots simply search twitter stream for predefined keywords and tweet target messages to the tweeters. These bots can be set via cron to read stream every few minutes and make responses in real time.</p>
<p>For newbies and starters all Twitter API documentation can be found <a href="http://apiwiki.twitter.com/Twitter-API-Documentation">here</a> , From here we are going to use Search API methods and Status Update REST api method for sending predefined tweets to the users.<br />
<span id="more-550"></span><br />
Search API can give output both in JSON and ATOM(XML) format , And can take several parameters for searching twitter stream. We are going to use just the query(q) parameter to provide keyword to the search ,A complete parameter list can be found <a href="http://apiwiki.twitter.com/Twitter-Search-API-Method%3A-search">here </a> .</p>
<p>So , Let&#8217;s take the parameter query as PHP problem and send them our link of phpcollection.com in the tweet. For this we will first search the twitter stream for the keyword PHP problem</p>
<pre class="php">
< ?php
$url = "http://search.twitter.com/search.atom?q=urlencode(PHP+problem)";
</pre>
<p>The response of this query is in a XML format so we will use simplexml PHP extension for converting this XML data in native PHP object. simplexml_load_file function loads and converts xml data directly from the url. It can be easily then traversed via a Php object.</p>
</pre>
<pre class="php">
$data = simplexml_load_file($url);
</pre>
<p>Now the data can be traversed via a foreach loop , $data->entry contains a array of all tweet entries. We will take them one by one in $value. Tweet username can be accessed via $value->author->uri to whom we will be tweeting the predefined message.</p>
<pre class="php">
foreach ($data->entry as $value)
{
	$from_name = $value->author->uri;
	$from_name = str_replace ("http://twitter.com/", "", $from_name);
    	$message = "@$from_name Hey Buddy you can find solution to your problems at http://www.phpcollection.com #php";
</pre>
<p>Now we have the users who are looking for help in PHP language (via PHP problem keyword), Now using Twitter PHP wrapper we will tweet this message to the users. This can be easily achieved via CURL, However for the sake of the tutorial we will use <a href="http://www.phpcollection.com/classes/mytwitter.php.zip">mytwitter php class</a> for tweeting back to users.</p>
<pre class="php">
		require_once( 'mytwitter.php' );
		$twitter =  new MyTwitter('phpcollection', '**********');
 		$result = $twitter->updateStatus($message);
}
?>
</pre>
<p>Complete code can be <a href="http://www.phpcollection.com/classes/twitter_bot.php.zip">downloaded here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://phpcollection.com/twitter-bot/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Open Dada PHP Class &#8211; Ringtone Affiliate API</title>
		<link>http://phpcollection.com/open-dada-php-class-ringtone-affiliate-api/</link>
		<comments>http://phpcollection.com/open-dada-php-class-ringtone-affiliate-api/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 05:31:50 +0000</pubDate>
		<dc:creator>Php Ninza</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.phpcollection.com/?p=726</guid>
		<description><![CDATA[Recently i needed to make a ringtone download website for a friend and we researched on web for a good affiliate with a decent API to make things easier for content download and integration on website. We ended choosing OpenDada.com which is a affiliate website for dada.net , Dada.net is a premier provider for providing [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Recently i needed to make a ringtone download website for a friend and we researched on web for a good affiliate with a decent API to make things easier for content download and integration on website.</p>
<p>We ended choosing OpenDada.com which is a affiliate website for dada.net , Dada.net is a premier provider for providing ringtones and other mobile content.</p>
<p>The API documentation for OpenDada can be found at <a href="http://www.opendada.com/docs/Search_API">API docs page</a> .</p>
<p>There are four methods that are defined in the class, Namely they are:-</p>
<p><span style="color: #0000bb;">search_ringtone</span><span style="color: #004000;">(&#8220;ARTIST NAME&#8221;</span><span style="color: #004000;">);</span></p>
<p><span style="color: #0000bb;">top10</span><span style="color: #004000;">();</span></p>
<p><span style="color: #0000bb;">display_single_ringtone</span><span style="color: #004000;">(</span><span style="color: #c00000;">&#8220;ARTIST NAME&#8221;</span><span style="color: #004000;">, </span><span style="color: #c00000;">&#8220;SONG TITLE&#8221;</span><span style="color: #004000;">);</span></p>
<p><span style="color: #0000bb;">get_genre</span><span style="color: #004000;">(</span><span style="color: #c00000;">&#8220;GENRE&#8221;</span><span style="color: #004000;">); </span></p>
<p>All methods are explained in the example.php file and can be found  <a href="http://www.phpclasses.org/browse/package/5636.html">here</a>.</p>
<p>Todo List:-</p>
<p>1) Add functionality to get more than 10 ringtones.<br />
2)<span style="text-decoration: line-through;"> Put the class in phpclasses.org </span><br />
3) Add option of inserting partner id</p>
<p>Will update the class with more functionality sooner.</p>
]]></content:encoded>
			<wfw:commentRss>http://phpcollection.com/open-dada-php-class-ringtone-affiliate-api/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>5 important tips for Debugging PHP Code</title>
		<link>http://phpcollection.com/5-php-debug-tips-important-for-debugging/</link>
		<comments>http://phpcollection.com/5-php-debug-tips-important-for-debugging/#comments</comments>
		<pubDate>Sat, 29 Aug 2009 11:32:25 +0000</pubDate>
		<dc:creator>Php Ninza</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Php Performance]]></category>

		<guid isPermaLink="false">http://www.phpcollection.com/?p=727</guid>
		<description><![CDATA[Debugging PHP code is a  nightmare for all Php developers and these are the times when they miss the thread functionality like java in php, However some simple php debugging techniques can help y0u to code faster and thus save very valuable coding time. These all debugging techniques are based on my experience and i would [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Debugging PHP code is a  nightmare for all Php developers and these are the times when they miss the thread functionality like java in php, However some simple php debugging techniques can help y0u to code faster and thus save very valuable coding time.</p>
<p>These all debugging techniques are based on my experience and i would love to know what more techniques php programmers use for debugging there php code !, Please comment below and share with community if you know a secret weapon in php code debugging.</p>
<p>So , My 5 debugging tips are (in no particular order):-<br />
<span id="more-727"></span><br />
1) <strong><span style="text-decoration: underline;">Live PHP debugging</span></strong>:- Use a editor with inbuilt live Php debug (Like phped ,Phpdesigner, eclipse etc), Editors like editpad, notepad doesn&#8217;t support live debugging and thus need to run the php file on browser for finding the errors. These editors run php scripts via command line on every save and present any errors found.</p>
<p>Small human errors like missing a semicolon , not terminating the line correctly, missing brackets etc can be easily found using a live debug php editor.</p>
<p>2) <strong><span style="text-decoration: underline;">Use Xdebug</span>:-<span style="font-weight: normal;">The Xdebug extension allows you to find  stack traces and function traces in error messages, memory allocation and protect from infinite recursions happening</span></strong></p>
<p style="line-height: 1.5em;">It also provides profiling information for PHP code and is having the capability to debug scripts interactively with a debug client.</p>
<p style="line-height: 1.5em;">Xdebug can be found at <a href="http://www.xdebug.org/">xdebug.org</a> (Editors like Phpdesigner and phpdebug already contain Xdebug inbuilt )</p>
<p style="line-height: 1.5em;">
<p style="line-height: 1.5em;"><strong>3) </strong><strong><span style="text-decoration: underline;">Activate Php error messages:-</span> </strong>php.ini contains a lot of configuration options , Among those options there are a couple of options which control the way error messages are displayed to a user. Make sure that following two options are set as follows:-</p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="font-family: arial, sans-serif; background-color: #f7f7f7 !important; padding-top: 2px; padding-right: 2px; padding-bottom: 5px; padding-left: 2px; font-size: 0.75em; border: 1px solid #cccccc;">
<pre style="overflow: auto; width: 694px; margin-top: 0px; margin-bottom: 0px; font-family: 'Andale Mono','Lucida Console',Monaco,Liberation,fixed,monospace; font-size: 11px; background-color: #f7f7f7 ! important; color: #000000;">display_errors = On</pre>
<pre style="overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; line-height: 18px; font-size-adjust: none; font-stretch: normal; width: 694px; margin-top: 0px; margin-bottom: 0px; font-family: 'Andale Mono','Lucida Console',Monaco,Liberation,fixed,monospace; font-size: 11px; background-color: #f7f7f7 ! important; color: #000000;">error_reporting = E_ALL &amp; ~E_NOTICE</pre>
</td>
</tr>
</tbody>
</table>
<p style="line-height: 1.5em;">
<p style="line-height: 1.5em;"><strong><span style="text-decoration: underline;">4) Use print and echo statements beforehand at critical points for debug:-</span> </strong>This is somewhat a homegrown method that i use for php debugging which i found extremely helpful and useful in debugging big php codes.</p>
<p style="line-height: 1.5em;">While coding i create some virtual sections of code and in these virtual sections i put the echo statement to ensure that the code is passing through that portion correctly and echoing the data correctly that&#8217;s required.</p>
<p style="line-height: 1.5em;">But since i can&#8217;t left them always on , I put up a debug_check if statement to check whether the code is working in debug mode or production mode.</p>
<p style="line-height: 1.5em;">For example</p>
<pre name="code" class="php">
< ?php

$debug_check = 1;

foreach ($array as $data) {

    if ($debug_check == 1)

        print ($data);

}

?>
</pre>
<p style="line-height: 1.5em;">Here the $debug_check variable is defined at the top of the web script. Once this is changed to 1, it displays all echo and print statements , This is when i am debugging the code.</p>
<p style="line-height: 1.5em;">When i am in production mode i simply change the value of $debug_check to 0 which again hide all echo and print statements,  This takes a little more time in coding initally , but proves to very helpful in long run.</p>
<p style="line-height: 1.5em;">
<p style="line-height: 1.5em;">5) <strong><span style="text-decoration: underline;">Use Frameworks:-</span> </strong>Frameworks are one of the most important change that is implemented in modern programming , Php frameworks like codeignitor and cakephp provides a lot of functionality for setting up test cases, units and debugging.</p>
<p style="line-height: 1.5em;">Also, Since most of the code is ran via libraries the error messages are nicely crafted and provides inbuilt details.</p>
<p style="line-height: 1.5em;">Two most favourite frameworks of mine are:- <a href="http://cakephp.org">Cakephp</a> and <a href="http://codeigniter.com/">Codeignitor</a></p>
<p style="line-height: 1.5em;">Hope everyone enjoyed thsese 5 debugging techniques in PHP , I request everyone to share there piece of advise in php debugging , Will be compiling all of them in a a blog post with proper credits and publishing it !, It might proves useful to every php developer around the world.</p>
]]></content:encoded>
			<wfw:commentRss>http://phpcollection.com/5-php-debug-tips-important-for-debugging/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Enable mod_rewrite in windows , WAMP, XAMPP</title>
		<link>http://phpcollection.com/mod-rewrite-windows-wamp-xampp/</link>
		<comments>http://phpcollection.com/mod-rewrite-windows-wamp-xampp/#comments</comments>
		<pubDate>Sat, 22 Aug 2009 09:51:09 +0000</pubDate>
		<dc:creator>Php Ninza</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Rewrite]]></category>
		<category><![CDATA[WAMP]]></category>
		<category><![CDATA[XAMPP]]></category>

		<guid isPermaLink="false">http://www.phpcollection.com/?p=707</guid>
		<description><![CDATA[Wamp and XAMPP doesn’t come with default rewrite rule enabled, For enabling the rewrite rules in both of them you need to make changes in httpd.conf so that apache can work with rewrite rules. For enabling the rewrite rules follow these rules:- 1) find httpd.conf (usually this file can be found in folder callled conf [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Wamp and XAMPP doesn’t come with default rewrite rule enabled, For enabling the rewrite rules in both of them you need to make changes in httpd.conf so that apache can work with rewrite rules.</p>
<p>For enabling the rewrite rules follow these rules:-</p>
<p>1) find httpd.conf (usually this file can be found in folder callled conf , config or something along those lines)</p>
<p><span id="more-707"></span></p>
<p>2) Find and uncomment the line LoadModule rewrite_module modules/mod_rewrite.so</p>
<p>3) Find the line with DocumentRoot &#8220;C:/path/to/my/root&#8221;, There you will find contents like</p>
<blockquote><p>&lt;Directory&gt;</p>
<p>&lt;/Directory&gt;</p></blockquote>
<p>Make sure the content inside these two braces looks like</p>
<blockquote><p>&lt;Directory&gt;</p>
<p>Options All</p>
<p>AllowOverride All</p>
<p>&lt;/Directory&gt;</p></blockquote>
<p>4) All done now restart the Apache server and you will be all good to go</p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:f1a6bd61-3aae-45a1-92d6-b61be953f4d6" class="wlWriterEditableSmartContent" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/Rewrite">Rewrite</a>,<a rel="tag" href="http://technorati.com/tags/XAMPP">XAMPP</a>,<a rel="tag" href="http://technorati.com/tags/WAMP">WAMP</a>,<a rel="tag" href="http://technorati.com/tags/apache">apache</a></div>
]]></content:encoded>
			<wfw:commentRss>http://phpcollection.com/mod-rewrite-windows-wamp-xampp/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Creating a cache file in php for API requests</title>
		<link>http://phpcollection.com/creating-a-cache-file-in-php-for-api-requests/</link>
		<comments>http://phpcollection.com/creating-a-cache-file-in-php-for-api-requests/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 08:02:11 +0000</pubDate>
		<dc:creator>Php Ninza</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Php Performance]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[REST api]]></category>
		<category><![CDATA[Twitter API]]></category>

		<guid isPermaLink="false">http://www.phpcollection.com/?p=702</guid>
		<description><![CDATA[Web 2.0 was all about mashups and data api’s !, Some of the popular ones are google search api , twitter api etc. All API’s have some rate-limiting , For example Twitter API has a rate limit of 150 requests per hour ! , Yahoo API and Google API’s have a daily limit on their [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Web 2.0 was all about mashups and data api’s !, Some of the popular ones are google search api , twitter api etc.</p>
<p>All API’s have some rate-limiting , For example Twitter API has a rate limit of 150 requests per hour ! , Yahoo API and Google API’s have a daily limit on their requests.</p>
<p>The ultimate method of getting over this API request limit is to make a cache method which stores all data that is coming from API , Which you can refresh hourly, weekly or daily !<br />
<span id="more-702"></span><br />
That&#8217;s why i created a small function to store the API data in a xml cache file , Which can be later on retrieved to get data.Find that function below, Most of the functionality is explained in the comments , If anything is not clear contact me via <a href="http://www.phpcollection.com/about">contact page</a>.</p>
<pre class="php">< ?php

function get_yahoo_data_cached($query, $zip) {
    // Rewrite by Julius Beckmann

    // Remove dangerous chars
    $query_safe = str_replace(array('.','/'), '_', $query);
    $zip_safe = str_replace(array('.','/'), '_', $zip);

    $cache_filename = "cache/$query_safe-$zip_safe.xml";
    $time_expire = time() + 24*60*60; // Expire Time (1 Day)

    // Check file change time
    if(filectime($filename) <= $time_expire) {
        // File is too old, refresh cache
        $xml = get_yahoo_data($query, $zip);
        // Remove cache file on error to avoid writing wrong xml
        if($xml)
            file_put_contents($cache_filename, $xml);
        else
            unlink($cache_filename);
    }else{
        // Fetch cache
        $xml = file_get_contents($cache_filename);
    }

    return $xml;
}

?>
</pre>
<p>Safe rewrite of the function by <a href="http://juliusbeckmann.de">Julius Beckmann</a>  <br />
This function creates a cache file for yahoo api requests , here we are using get_yahoo_data() function to fetch data from yahoo api which is a custom function for extracting data from yahoo api and throwing that in xml output format.</p>
<p>If we do a small synopsis of the above function we can see that it uses 2 variables to store cache , $filename stores the cache file and $file_log_name stores the last update time for that cache !</p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:68b0a9b9-ef17-40a4-97de-308d796ee056" class="wlWriterEditableSmartContent" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/Cache">Cache</a>,<a rel="tag" href="http://technorati.com/tags/Twitter+API">Twitter API</a>,<a rel="tag" href="http://technorati.com/tags/REST+api">REST api</a></div>
]]></content:encoded>
			<wfw:commentRss>http://phpcollection.com/creating-a-cache-file-in-php-for-api-requests/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>5 upcoming Apis of Google that will change the way mashups are made</title>
		<link>http://phpcollection.com/5-apis-google-important-for-web2-mashup/</link>
		<comments>http://phpcollection.com/5-apis-google-important-for-web2-mashup/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 10:43:57 +0000</pubDate>
		<dc:creator>Php Ninza</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.phpcollection.com/?p=671</guid>
		<description><![CDATA[In my opinion one of the top most API&#8217;s used globaly on web portals is Google Search API, Google is famous for building world class API&#8217;s to harness the unique data Google collected with it&#8217;s excellent set of technology. Google Labs is the ultimate playground of Google which he use for developing and testing there [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>In my opinion one of the top most API&#8217;s used globaly on web portals is Google Search API, Google is famous for building world class API&#8217;s to harness the unique data Google collected with it&#8217;s excellent set of technology.</p>
<p><strong><a href="http://code.google.com/labs/">Google Labs</a></strong> is the ultimate playground of Google which he use for developing and testing there upcoming API&#8217;s , They have some exciting set of API&#8217;s currently in building. Which promise better web and can provide better value than Google Maps and Google Search API&#8217;s</p>
<p><span id="more-671"></span></p>
<p><strong><a href="http://code.google.com/apis/o3d/">Google O3D API</a></strong>:-</p>
<p>Virtual reality is the most discussed and researched technology few years back and it has proved it&#8217;s mark with the success of Second Life. O3D is natural extension to it and looks like it&#8217;s a extension to much hyped but failed technology VRML (Quotation needed)</p>
<p>Here&#8217;s a small example demo that is made using o3d Technology, Notice the amount of detail which goes in the demo video.<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="560" height="340" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/uofWfXOzX-g&amp;hl=en&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="560" height="340" src="http://www.youtube.com/v/uofWfXOzX-g&amp;hl=en&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>It&#8217;s Technical documentation can be found <a href="http://code.google.com/apis/o3d/docs/devguideintro.html">here</a> , Also you can be a part of early developers league by joining this group <a href="http://http://code.google.com/apis/o3d/docs/groups.html">o3D developers group </a></p>
<p><a href="http://code.google.com/apis/wave"><strong>Google Wave API</strong></a>:-<br />
Google Wave is another big collabration tool that Google is coming with, Aspired to be the next logical invention of Email . Google Wave innovates the collabration market with their wonderful approach of centric objects.  <a href="http://wave.google.com/"><strong>Google Wave</strong></a> can be accessed via <a href="http://code.google.com/apis/wave/"><strong>Google wave APi</strong></a> which can be integrated with applications for collabrtation<strong></strong> . Google presented a keynote which presented some cool features of Google Wave</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="560" height="340" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/v_UyVmITiYQ&amp;hl=en&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="560" height="340" src="http://www.youtube.com/v/v_UyVmITiYQ&amp;hl=en&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Developers can check out some cool wave applications at <a href="http://wave-samples-gallery.appspot.com/"><strong>Wave Sample gallery</strong></a> and check out the technical documentation <a href="http://code.google.com/apis/wave/guide.html">here</a> , Unfortunately Google wave currently have only Client libraries for Python and Java , We look forward to the Php library from Google soon.</p>
<p><strong><a href="http://code.google.com/apis/gears/">Google Gears API</a></strong>:-</p>
<p>Google Gears and Adobe Air are two upcoming technologies that promise leveraging the power of desktop onto web , Google Gears API is a powerful tool for building web applications that can interact with the users desktops , Features like local caching, Storing user data locally and asynchronous threads are some powerful feature that can now be used on web apps.</p>
<p>Google Gears sample applications can be found <a href="http://code.google.com/apis/gears/sample.html">here</a> and Technical documentation can be found at <a href="http://code.google.com/apis/gears/design.html">this page</a></p>
<p><a href="http://code.google.com/apis/analytics/docs/gdata/gdataDeveloperGuide.html"><strong>Google Analytics API</strong></a>:- The most common tool that webmasters use is the analytics tool for their website and Google analytics is the ultimate data churning tool for any website, If used properly Analytics can dig down to the deepest point of the content and traffic coming on web app or portal.</p>
<p>Several mertrics system like Mint , Quantcast etc exist today and provides extensive data, But the google analytics api can prove to be a milestone in extracting and tracking the traffic details that can effect your ROI.</p>
<p>Google analytics documentation can be located <a href="http://code.google.com/apis/analytics/docs/gdata/gdataDeveloperGuide.html"><strong>here</strong></a></p>
<p><a href=" http://code.google.com/apis/coupons/"><strong>Google Coupons:-</strong></a> Two words that bring maximum ROI in any form of business are <strong>FREE and SALE </strong>.</p>
<p>Coupons are one of the most searched terms on the web, Providing ecommerce users good discount on items, What could be better than the coupons data from the leader in data collection itself !, The coupons API !</p>
<p>Coupons API provide easy import to coupons data which can be used by business users, This is pretty same as the legendy google base tool which allow webmasters and business people to upload information about their product listing.</p>
<p>Coupons uploaded through coupon API will be indexed on google and will be presented to all users on searching for that product or relevant keywords.</p>
<p>It&#8217;s documentation can be found at <a href="http://code.google.com/apis/coupons/">this site</a></p>
<p>Hope you guys liked this list of API&#8217;s , Will love to listen your comments and any another set of API&#8217;s i missed.</p>
]]></content:encoded>
			<wfw:commentRss>http://phpcollection.com/5-apis-google-important-for-web2-mashup/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

