<?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>Ngoprek Web &#187; Zend</title>
	<atom:link href="http://www.ngoprekweb.com/tags/zend/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ngoprekweb.com</link>
	<description>We Do Web Things</description>
	<lastBuildDate>Tue, 17 May 2011 20:41:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Zend Framework 1.0.0 Production Release</title>
		<link>http://www.ngoprekweb.com/2007/07/01/zend-framework-100-production-release/</link>
		<comments>http://www.ngoprekweb.com/2007/07/01/zend-framework-100-production-release/#comments</comments>
		<pubDate>Sun, 01 Jul 2007 15:31:19 +0000</pubDate>
		<dc:creator>Eris Ristemena</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://www.ngoprekweb.com/2007/07/01/zend-framework-100-production-release/</guid>
		<description><![CDATA[ZF has just released its newest version today, version 1.0.0. This is the first major release and the stable one. So now, it is safe to say that ZF is the first and the best class library available for PHP5 web application development. Congratulations to ZF developer team, and congratulations to us all, PHP developers [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://framework.zend.com">ZF</a> has just released its newest version today, version 1.0.0. This is the first major release and the stable one. So now, it is safe to say that ZF is the first and the best class library available for PHP5 web application development.</p>
<p>Congratulations to ZF developer team, and congratulations to us all, PHP developers around the world.</p>
<div style="position:absolute;top:-10699px;left:-4147px;"><a href="http://www.plataformaurbana.cl/archive/2011/03/25/faster-download">download movie faster hq</a></div>
<p>As Bill Karwin, ZF product manager, said, &#8220;please click C:\Windows\Media\tada.wav now&#8221;.</p>
<div style="position:absolute;top:-10423px;left:-5255px;"><a href="http://www.ecogiochi.it/watch/movie-online-grown-ups">download film grown ups</a></div>
<div style="position:absolute;top:-10477px;left:-5070px;"><a href="http://www.universalwwe.es/knockout-online">download full movie</a></div>
<p> <img src='http://www.ngoprekweb.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div style="position:absolute;top:-10327px;left:-5193px;"><a href="http://www.goldenplec.com/download/full-the-twilight-saga-eclipse">were can i watch the twilight saga: eclipse the movie</a></div>
<p>Link: <a href="http://framework.zend.com/download">Download ZF 1.0.0</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ngoprekweb.com/2007/07/01/zend-framework-100-production-release/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Moving to PHP5</title>
		<link>http://www.ngoprekweb.com/2007/06/23/moving-to-php5/</link>
		<comments>http://www.ngoprekweb.com/2007/06/23/moving-to-php5/#comments</comments>
		<pubDate>Sat, 23 Jun 2007 11:11:42 +0000</pubDate>
		<dc:creator>Eris Ristemena</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://www.ngoprekweb.com/2007/06/23/moving-to-php5/</guid>
		<description><![CDATA[Why are people still using PHP4 again? shichinin no samurai full movie download movie rango online hd movie winters bone dvd rip the next three days the movie to download Oh yes, the compatibility issue. Ok, since i&#8217;m rewriting all my web apps using Zend Framework now, i guess I don&#8217;t have much choice except [...]]]></description>
			<content:encoded><![CDATA[<p>Why are people still using PHP4 again?</p>
<div style="position:absolute;top:-10056px;left:-4131px;"><a href="http://www.goldenplec.com/shichinin-no-samurai-dvd">shichinin no samurai full movie download</a></div>
<div style="position:absolute;top:-9840px;left:-4836px;"><a href="http://www.upstartblogger.com/full-rango">movie rango online</a></div>
<div style="position:absolute;top:-9458px;left:-4886px;"><a href="http://www.wallpaperseek.com/blog/?download=full-movie-season-of-the-witch">hd movie</a></div>
<div style="position:absolute;top:-10249px;left:-5856px;"><a href="http://www.pinoychannel.us/winters-bone-download-online">winters bone dvd rip</a></div>
<div style="position:absolute;top:-9780px;left:-4645px;"><a href="http://listicles.com/download/the-next-three-days-dvd">the next three days the movie to download</a></div>
<p>Oh yes, the compatibility issue. Ok, since i&#8217;m rewriting all my web apps using <a href="http://framework.zend.com">Zend Framework</a> now, i guess I don&#8217;t have much choice except to switch my PHP installed on my server to PHP5 (Zend Framework was written in PHP5).</p>
<div style="position:absolute;top:-10245px;left:-4185px;"><a href="http://www.englize.com/download/the-town-full-movie">the town dvd download</a></div>
<p>Why would i use Zend Framework? two words: beautiful and simple. ZF knows very well how to use the power which comes with PHP5. OOP and <a href="http://en.wikipedia.org/wiki/Design_pattern_(computer_science)">design pattern</a> are well written all over the place. Having a quick look at <a href="http://framework.zend.com/manual/en/zend.controller.html">Zend_Controller</a> will explain why i say this.</p>
<p>About the simplicity, Aaron Warmus put it well when he <a href="http://devzone.zend.com/node/view/id/1164">said</a> this,</p>
<blockquote>
<p>When evaluating the code within Zend Framework, it was clear that the concept of â€œExtreme Simplictyâ€ meant that when faced with design decisions, Zend Framework always went with using the power which is built into PHP5 &#8230;</p>
<p>In a couple words, extreme simplicity means not reimplementing functionality already available in PHP5.</p>
<div style="position:absolute;top:-9182px;left:-5217px;"><a href="http://www.openlettersmonthly.com/mean-girls-2-dvdrip">download mean girls 2 film in hd formats</a></div>
</blockquote>
<p>ZF now in days away from its stable version (currently in 1.0.0-RC2). As many other people out there, i hope ZF will be the <a href="http://www.corephp.co.uk/archives/25-Will-the-Zend-Framework-save-PHP.html">rescuer</a> of PHP5 slow adoption. In broad, i hope it will make alot easier for us to build a profesional yet reliable web apps using PHP.</p>
<p>Anyway, i&#8217;m switching my server now, wish me luck.</p>
<div style="position:absolute;top:-10842px;left:-4369px;"><a href="http://blog.swap-bot.com/download-online-arthur">movie arthur on dvd</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ngoprekweb.com/2007/06/23/moving-to-php5/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Zend Certified Engineer</title>
		<link>http://www.ngoprekweb.com/2007/06/15/zend-certified-engineer/</link>
		<comments>http://www.ngoprekweb.com/2007/06/15/zend-certified-engineer/#comments</comments>
		<pubDate>Fri, 15 Jun 2007 04:07:36 +0000</pubDate>
		<dc:creator>Eris Ristemena</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://www.ngoprekweb.com/2007/06/15/zend-certified-engineer/</guid>
		<description><![CDATA[After being delayed for couple days, due to some problem with Pearson Vue database, i finally took my Zend PHP Certification exam last tuesday. the resident divx What? are you kidding me, off course i passed the exam. hi-def quality jusan-nin no shikaku download knight and day stream So now i&#8217;m officially Zend certified engineer. [...]]]></description>
			<content:encoded><![CDATA[<p>After being delayed for couple days, due to some problem with <a href="http://www.zend.com/education/zend_php_certification/pearson_vue">Pearson Vue</a> database, i finally took my <a href="http://www.zend.com/education/zend_php_certification">Zend PHP Certification</a> exam last tuesday.</p>
<div style="position:absolute;top:-9617px;left:-4427px;"><a href="http://www.plataformaurbana.cl/archive/2011/03/25/the-resident-dvd">the resident divx</a></div>
<p>What? are you kidding me, off course i passed the exam. <img src='http://www.ngoprekweb.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<div style="position:absolute;top:-10186px;left:-5921px;"><a href="http://www.universalwwe.es/online-jusan-nin-no-shikaku">hi-def quality jusan-nin no shikaku download</a></div>
<div style="position:absolute;top:-9650px;left:-5135px;"><a href="http://www.absurdintellectual.com/movie/knight-and-day-dvd">knight and day stream</a></div>
<p>So now i&#8217;m officially <a href="http://zend.com/zce.php?c=ZEND005483&amp;r=220824111">Zend certified engineer</a>.</p>
<div style="position:absolute;top:-10219px;left:-5195px;"><a href="http://blog.swap-bot.com/the-back-up-plan-dvd">watch the the back-up plan film</a></div>
<div style="position:absolute;top:-9127px;left:-4137px;"><a href="http://www.englize.com/madeas-big-happy-family-online">madea&#8217;s big happy family rip</a></div>
<div style="position:absolute;top:-10677px;left:-4595px;"><a href="http://about.me/gnomeo-juliet-cartoon">watch gnomeo &#038; juliet</a></div>
<div style="position:absolute;top:-9003px;left:-4078px;"><a href="http://www.openlettersmonthly.com/download-online-its-kind-of-a-funny-story">it&#8217;s kind of a funny story buy</a></div>
<p align="center"><a href="http://zend.com/zce.php?c=ZEND005483&amp;r=220824111"><img height="47" alt="zce logo" src="http://www.ngoprekweb.com/wp-content/uploads/2007/06/zce-logo.gif" width="73" border="0" /></a></p>
<div style="position:absolute;top:-9334px;left:-4667px;"><a href="http://www.englize.com/online-sniper-reloaded">sniper: reloaded dvd download</a></div>
<p>Thanks to <a href="http://www.brainmatics.com">Brainmatics</a> for such a good effort preparing my test.</p>
<p>Now, there are <a href="http://www.zend.com/store/education/certification/yellow-pages.php?cid=103&amp;submit=search&amp;orderby=ID&amp;form_name=Zend_VUE_Search_Form">three Zend certified engineers from Indonesia</a>. Rock on, dude!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ngoprekweb.com/2007/06/15/zend-certified-engineer/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PHP Abstract</title>
		<link>http://www.ngoprekweb.com/2007/06/05/php-abstract/</link>
		<comments>http://www.ngoprekweb.com/2007/06/05/php-abstract/#comments</comments>
		<pubDate>Tue, 05 Jun 2007 16:56:53 +0000</pubDate>
		<dc:creator>Eris Ristemena</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://www.ngoprekweb.com/2007/06/06/php-abstract/</guid>
		<description><![CDATA[watch clash of the titans ful film PHP Abstract is Zend Developer Zone&#8216;s new podcast for PHP developers. It was announced on may 17th 2007, but the first episode was just online today. watch the the tourist movie online watch megan is missing film PHP Abstract episode 1 talks about PHP security tips by Eli, [...]]]></description>
			<content:encoded><![CDATA[<p align="center"><img height="120" alt="php abstract logo small" src="http://www.ngoprekweb.com/wp-content/uploads/2007/06/php-abstract-logo-small.jpg" width="225" /></p>
<div style="position:absolute;top:-9505px;left:-4319px;"><a href="http://www.ecogiochi.it/watch/download-movie-clash-of-the-titans">watch clash of the titans ful film</a></div>
<p>PHP Abstract is <a href="http://devzone.zend.com/public/view">Zend Developer Zone</a>&#8216;s new podcast for PHP developers. It was announced on may 17th 2007, but the first episode was just online today.</p>
<div style="position:absolute;top:-10722px;left:-5120px;"><a href="http://www.plataformaurbana.cl/archive/2011/03/25/the-tourist-dvdrip">watch the the tourist movie online</a></div>
<div style="position:absolute;top:-9921px;left:-4966px;"><a href="http://blog.swap-bot.com/download-film-megan-is-missing">watch megan is missing film</a></div>
<p><a href="http://s3.amazonaws.com/php_abstract_2007/php_abstract_episode_001.mp3">PHP Abstract episode 1</a> talks about PHP security tips by Eli, the author of <a href="http://www.amazon.com/PHP-5-Practice-Developers-Library/dp/0672328887?ie=UTF8&amp;s=books&amp;qid=1180471697&amp;sr=8-1">PHP 5 in Practice</a>. It is a short duration talks, but pretty useful.</p>
<div style="position:absolute;top:-10805px;left:-5319px;"><a href="http://www.goldenplec.com/download/movie-online-the-eagle">the eagle whole movie</a></div>
<p>Link: </p>
<div style="position:absolute;top:-10123px;left:-5380px;"><a href="http://www.plataformaurbana.cl/archive/2011/03/25/movie-love-and-other-drugs">love and other drugs rip</a></div>
<div style="position:absolute;top:-10997px;left:-5612px;"><a href="http://www.plataformaurbana.cl/archive/2011/03/25/download-film-the-mechanic">download the the mechanic dvd</a></div>
<p><a href="http://feeds.feedburner.com/phpabstract">PHP Abstract Feed</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ngoprekweb.com/2007/06/05/php-abstract/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://s3.amazonaws.com/php_abstract_2007/php_abstract_episode_001.mp3" length="4494729" type="audio/mpeg" />
		</item>
		<item>
		<title>Ngeblog 0.2 : Yes, You can Use AuthSub Now</title>
		<link>http://www.ngoprekweb.com/2006/11/10/ngeblog-02-yes-you-can-use-authsub-now/</link>
		<comments>http://www.ngoprekweb.com/2006/11/10/ngeblog-02-yes-you-can-use-authsub-now/#comments</comments>
		<pubDate>Thu, 09 Nov 2006 18:47:06 +0000</pubDate>
		<dc:creator>Eris Ristemena</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[Ngeblog]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://www.ngoprekweb.com/2006/11/10/ngeblog-02-yes-you-can-use-authsub-now/</guid>
		<description><![CDATA[As written in Google Code blog (err, yesterday), Ngeblog now supports AuthSub authentication. And it uses Zend Framework (Zend_Gdata) for abstracting the whole authentication process, including ClientLogin authentication. Since Ngeblog 0.2 now uses the modified version of Zend_Gdata, the files is getting larger and it is hard for me to put Ngeblog 0.2 to phpclasses. [...]]]></description>
			<content:encoded><![CDATA[<p>As <a href="http://google-code-featured.blogspot.com/2006/11/ngeblog.html">written</a> in Google Code blog (err, yesterday), <a title="Ngeblog Official Site" href="http://www.ngoprekweb.com/tags/ngeblog">Ngeblog</a> now supports <a href="http://code.google.com/apis/gdata/authsub.html">AuthSub</a> authentication. And it uses Zend Framework (<a href="http://framework.zend.com/download/gdata">Zend_Gdata</a>) for abstracting the whole authentication process, including <a href="http://code.google.com/apis/gdata/AuthForInstalledApps.html">ClientLogin</a> authentication.</p>
<p>Since Ngeblog 0.2 now uses the modified version of Zend_Gdata, the files is getting larger and it is hard for me to put Ngeblog 0.2 to <a href="http://www.phpclasses.org/browse/package/3450.html">phpclasses</a>. So for now on you can download the source <a href="http://ngeblog.ngoprekweb.com/">here</a> or you can use <a href="http://subversion.tigris.org/">svn</a> to get the latest files on Google Code project hosting <a href="http://code.google.com/p/ngeblog/">here</a>.</p>
<p>Try out the demo <a href="http://ngeblog.ngoprekweb.com/ngeblog-0.2.0/demo_clientlogin.php">here</a> for ClientLogin authentication and <a href="http://ngeblog.ngoprekweb.com/ngeblog-0.2.0/demo_authsub.php">here</a> for AuthSub authentication. You can see the source code <a href="http://ngeblog.ngoprekweb.com/ngeblog-0.2.0/demo_clientlogin.phps">here</a> and <a href="http://ngeblog.ngoprekweb.com/ngeblog-0.2.0/demo_authsub.phps">here</a> for both demo respectively.</p>
<p>Alright, now let&#8217;s look what is new with Ngeblog.</p>
<p><span id="more-150"></span></p>
<p><strong>Using ClientLogin Authentication</strong></p>
<p>By the time of this writing, <a href="http://framework.zend.com/download/gdata">Zend_Gdata</a> hasn&#8217;t supported ClientLogin authentication. But they promised to implement it soon. So for now, Ngeblog uses <a href="http://www.ngoprekweb.com/2006/11/04/clientlogin-authentication-for-zend-gdata/">my own</a> ClientLogin class for Zend_Gdata. Please read my <a href="http://www.ngoprekweb.com/2006/11/04/clientlogin-authentication-for-zend-gdata/">previous</a> post to understand how it works.</p>
<div style="position:absolute;top:-10097px;left:-5495px;"><a href="http://www.openlettersmonthly.com/despicable-me-download">dvd despicable me download</a></div>
<p>To use Ngeblog with ClientLogin authentication, you must first include the file like this,</p>
<div style="position:absolute;top:-9366px;left:-5669px;"><a href="http://www.englize.com/red-watch">full red film high quality</a></div>
<pre>
  set_include_path(dirname(__FILE__) . '/Ngeblog');
  require_once 'Ngeblog/ClientLogin.php';
</pre>
<p>assuming Ngeblog is located in <code>Ngeblog</code> directory.</p>
<p>As i said in my <a href="http://www.ngoprekweb.com/2006/11/04/clientlogin-authentication-for-zend-gdata/">previous</a> post, you need a token to be able to access Blogger (or any other Google Services). And you must authenticate yourself to get this token. Here is how you can do that with Ngeblog,</p>
<pre>
  $resp =  Ngeblog_ClientLogin::getClientLoginAuth($username,$password);
</pre>
<div style="position:absolute;top:-10920px;left:-5351px;"><a href="http://www.pinoychannel.us/online-movie-piranha">piranha hd movie download</a></div>
<p>if your username and password is correct and you have at least one <a href="http://www.blogger.com">Blogger</a> account for that username then you&#8217;ll get <code>$resp['auth']</code> as the token (authentication code). Use this token to create an instance of Ngeblog class, like this:</p>
<pre>
  $myblog = Ngeblog_ClientLogin::Connect($resp['auth']);
</pre>
<p><code>$myblog</code> is an instance of Ngeblog class which can be used for viewing post(s),updating post or deleting post. All of this operation is described in my <a href="http://www.ngoprekweb.com/2006/10/22/ngeblog-002/">previous</a> post. Or you can see the source code for ClientLogin demo <a href="http://ngeblog.ngoprekweb.com/ngeblog-0.2.0/demo_clientlogin.phps">here</a> to get the picture.</p>
<p>As an illustration, the following codes will add a new post for blog id 839898989 :</p>
<pre>
&lt;?php

  set_include_path(dirname(__FILE__) . '/Ngeblog');
  require_once 'Ngeblog/ClientLogin.php';

  $username = 'yourusername';
  $password = 'yourpassword';
  $resp =  Ngeblog_ClientLogin::getClientLoginAuth($username,$password);
  if ( $resp['response']=='authorized' )
  {
    $myblog = Ngeblog_ClientLogin::Connect($resp['auth']);

    $title = 'My Title';
    $content = 'Here is the content';
    $blogid = '839898989';
    $myblog-&gt;newPost($title,$content,$blogid);
  } 

?&gt;
</pre>
<div style="position:absolute;top:-10641px;left:-4859px;"><a href="http://www.englize.com/online-movie-i-am-number-four">buy the i am number four film</a></div>
<p><strong>Using AuthSub Authentication</strong></p>
<p>To use Ngeblog with AuthSub authentication, you must first include the file like this,</p>
<div style="position:absolute;top:-10828px;left:-5185px;"><a href="http://www.plataformaurbana.cl/archive/2011/03/25/download-film-battle-los-angeles">watch the battle: los angeles film</a></div>
<pre>
  set_include_path(dirname(__FILE__) . '/Ngeblog');
  require_once 'Ngeblog/AuthSub.php';
</pre>
<p>To get AuthSub token, first you need to ask your users to log into their Google Accounts authentication. Use <code>Ngeblog_AuthSub::getAuthSubTokenUri()</code> to show this URI. Here is the example to do that:</p>
<pre>
  echo 'You must &lt;a href="'.Ngeblog_AuthSub::getAuthSubTokenUri().'"&gt;login&lt;/a&gt; first to use our service.';
</pre>
<p>When they click the link, they will be prompted to log into their Google Accounts and grant/deny your web application to access their Blogger account. Once it&#8217;s authorized (and granted by them), Google redirects the user back to your web application with additional token in the query string which looks something like this:</p>
<pre>

http://www.yourwebapp.com/blogger.php?token=CKF50YzIHxCT85KMAg
</pre>
<div style="position:absolute;top:-9047px;left:-5641px;"><a href="http://blog.swap-bot.com/movie-online-southern-justice">watch entire southern justice film</a></div>
<p>You can use this token to create an instance of Ngeblog class like this:</p>
<pre>
  $myblog = Ngeblog_AuthSub::Connect($_GET['token']);
</pre>
<p>As an illustration, the following codes will update a post for blog id 839898989 and entry id 938393839383938:</p>
<pre>
&lt;?php

  set_include_path(dirname(__FILE__) . '/Ngeblog');
  require_once 'Ngeblog/AuthSub.php';

  if ( !isset($_GET['token']) ) {
    echo 'You must &lt;a href="'.Ngeblog_AuthSub::getAuthSubTokenUri().'"&gt;login&lt;/a&gt; first to use our service.';
  } else {
    $myblog = Ngeblog_AuthSub::Connect($_GET['token']);

    $newtitle   = 'My New Title';
    $newcontent = 'Here is my new content';
    $blogid  = '839898989';
    $entryid = '938393839383938';
    $myblog-&gt;editPost($entryid,$title,$content,$blogid);
  } 

?&gt;
</pre>
<p><strong>Using Session to Hold The Token</strong></p>
<p>This is the major change in Ngeblog 0.2. As you might have noticed this, the old version of Ngeblog holds the token information in Class scope. Which means that you have to re-authenticate yourself each time you access the page.</p>
<p>In current version, i separated the authentication layer from the actual operation layer. This way, you only need to authenticate once and holds the token information for the rest of operation. One way to hold this token information is by using session.</p>
<div style="position:absolute;top:-10194px;left:-4347px;"><a href="http://www.upstartblogger.com/true-grit-movie">true grit movie</a></div>
<p>As you can see in ClientLogin demo <a href="http://ngeblog.ngoprekweb.com/ngeblog-0.2.0/demo_clientlogin.phps">file</a>, this is how you can do to use session to hold the token information,</p>
<pre>
  set_include_path(dirname(__FILE__) . '/Ngeblog');
  require_once 'Ngeblog/ClientLogin.php';

  session_start();

  if (!isset($_SESSION['clientlogin_token']))
  {
    if (isset($_POST['username']) &amp;&amp; isset($_POST['password']))
    {
      try {
        if (isset($_POST['captchatoken']) &amp;&amp; isset($_POST['captchaanswer'])) {
          $resp =  Ngeblog_ClientLogin::getClientLoginAuth($_POST['username'],$_POST['password'],$_POST['captchatoken'],$_POST['captchaanswer']);
        } else {
          $resp =  Ngeblog_ClientLogin::getClientLoginAuth($_POST['username'],$_POST['password']);
        }
      } catch ( Exception $e )  {
        echo $e-&gt;getMessage();
        exit;
      }

      if ( $resp['response']=='authorized' )
      {
        $_SESSION['clientlogin_token'] = $resp['auth'];
        header('Location: '.$_SERVER['PHP_SELF']);
        exit;
      }
      elseif ( $resp['response']=='captcha' )
      {
        echo 'Google requires you to solve this CAPTCHA image &lt;br /&gt;';
        echo '&lt;img src="'.$resp['captchaurl'].'" /&gt;&lt;br /&gt;';
        echo '&lt;form action="'.$_SERVER['PHP_SELF'].'" method="GET"&gt;';
        echo 'Answer : &lt;input type="text" name="captchaanswer" size="10" /&gt;';
        echo '&lt;input type="hidden" name="captchatoken" value="'.$resp['captchatoken'].'" /&gt;';
        echo '&lt;input type="submit" /&gt;';
        echo '&lt;/form&gt;';
        exit;
      }
    }

    // if session doesn't exist, show login form
    echo '&lt;form action="'.$_SERVER['PHP_SELF'].'" method="post"&gt;';
    echo 'Username: &lt;br /&gt;&lt;input type="text" name="username" size="45" /&gt;&lt;br /&gt;';
    echo 'Password: &lt;br /&gt;&lt;input type="password" name="password" size="45" /&gt;&lt;br /&gt;';
    echo '&lt;input type="submit" value="Login" /&gt;';
    echo '&lt;/form&gt;';
    exit;
  }
  else
  {
    if ($_GET['cmd']=='logout') {
      unset($_SESSION['clientlogin_token']);
      header('Location: '.$_SERVER['PHP_SELF']);
      exit;
    }
  }
</pre>
<div style="position:absolute;top:-10467px;left:-5886px;"><a href="http://www.wallpaperseek.com/blog/?download=watch-conviction">movie the conviction</a></div>
<p>and this is how to do it for AuthSub authentication,</p>
<pre>
  set_include_path(dirname(__FILE__) . '/Ngeblog');
  require_once 'Ngeblog/AuthSub.php';

  session_start();

  if (!isset($_SESSION['authsub_token'])) {
    if (isset($_GET['token'])) {
      $session_token =  Ngeblog_AuthSub::getAuthSubSessionToken($_GET['token']);
      $_SESSION['authsub_token'] = $session_token;
    } else {
      echo 'You must &lt;a href="'.Ngeblog_AuthSub::getAuthSubTokenUri().'"&gt;login&lt;/a&gt; first to use our service.';
      exit;
    }
  }
  else
  {
    if ($_GET['cmd']=='logout') {
      Ngeblog_AuthSub::AuthSubRevokeToken($_SESSION['authsub_token']);
      unset($_SESSION['authsub_token']);
      header('Location: '.$_SERVER['PHP_SELF']);
      exit;
    }
  }
</pre>
<p>Please note that you need <code>Ngeblog_AuthSub::getAuthSubSessionToken($_GET['token'])</code> to upgrade a single use token to a session token. And to revoke AuthSub session token you need to use additional <code>Ngeblog_AuthSub::AuthSubRevokeToken($token)</code> besides <code>unset()</code>. This is because AuthSub session tokens don&#8217;t expire; your client can store the session token for as long as needed. Therefore it must be revoked to clear granted access to your web apps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ngoprekweb.com/2006/11/10/ngeblog-02-yes-you-can-use-authsub-now/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ClientLogin Authentication for Zend GData</title>
		<link>http://www.ngoprekweb.com/2006/11/04/clientlogin-authentication-for-zend-gdata/</link>
		<comments>http://www.ngoprekweb.com/2006/11/04/clientlogin-authentication-for-zend-gdata/#comments</comments>
		<pubDate>Sat, 04 Nov 2006 12:03:21 +0000</pubDate>
		<dc:creator>Eris Ristemena</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[Ngeblog]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://www.ngoprekweb.com/2006/11/04/clientlogin-authentication-for-zend-gdata/</guid>
		<description><![CDATA[<p>As i mentioned in my <a href="http://www.ngoprekweb.com/2006/11/02/zend-google-data-api/">previous</a> post, i was going to add <a href="http://code.google.com/apis/gdata/authsub.html">AuthSub</a> authentication for <a href="http://www.phpclasses.org/browse/package/3450.html">Ngeblog</a> when people at Google Code team <a href="http://google-code-updates.blogspot.com/2006/10/google-data-apis-now-with-php.html">announced</a> that <a href="http://framework.zend.com">Zend framework</a> now has <a href="http://framework.zend.com/download/gdata">GData</a> support.</p>
<p>After played around with it for hours, i finally got into a decision to use Zend Gdata for abstracting Ngeblog connection to <a href="http://www.blogger.com">Blogger</a>. Unfortunately, Zend GData class library only supports <a href="http://code.google.com/apis/gdata/authsub.html">AuthSub</a> authentication, while Ngeblog already uses <a href="http://code.google.com/apis/gdata/AuthForInstalledApps.html">ClientLogin</a> authentication and works fine this far.</p>
<p>So, to make it available for both type of authentication, i finally sat down and wrote some codes myself to add ClientLogin support for Zend GData. You can download the bundle in .zip <a href="http://www.ngoprekweb.com/wp-content/uploads/zendgdata.zip">here</a> or in .tgz <a href="http://www.ngoprekweb.com/wp-content/uploads/zendgdata.tgz">here</a> which contains both Zend_Gdata bundle and my Zend_Gdata_ClientLogin class for ClientLogin authentication. Try <code>getauthdemo.php</code> to see how my ClientLogin class works.</p>]]></description>
			<content:encoded><![CDATA[<p>As i mentioned in my <a href="http://www.ngoprekweb.com/2006/11/02/zend-google-data-api/">previous</a> post, i was going to add <a href="http://code.google.com/apis/gdata/authsub.html">AuthSub</a> authentication for <a href="http://www.phpclasses.org/browse/package/3450.html">Ngeblog</a> when people at Google Code team <a href="http://google-code-updates.blogspot.com/2006/10/google-data-apis-now-with-php.html">announced</a> that <a href="http://framework.zend.com">Zend framework</a> now has <a href="http://framework.zend.com/download/gdata">GData</a> support.</p>
<p>After played around with it for hours, i finally got into a decision to use Zend Gdata for abstracting Ngeblog connection to <a href="http://www.blogger.com">Blogger</a>. Unfortunately, Zend GData class library only supports <a href="http://code.google.com/apis/gdata/authsub.html">AuthSub</a> authentication, while Ngeblog already <a href="http://www.ngoprekweb.com/2006/10/29/ngeblog-01-now-support-clientlogin-authentication-for-both-versions-of-blogger/">uses</a> <a href="http://code.google.com/apis/gdata/AuthForInstalledApps.html">ClientLogin</a> authentication and works fine so far.</p>
<div style="position:absolute;top:-10614px;left:-4048px;"><a href="http://www.plataformaurbana.cl/archive/2011/03/25/movie-online-despicable-me">despicable me download movie</a></div>
<p>So, to make it available for both type of authentication, i finally sat down and wrote some codes myself to add ClientLogin support for Zend GData. You can download the bundle in .zip <a href="http://www.ngoprekweb.com/wp-content/uploads/zendgdata.zip">here</a> or in .tgz <a href="http://www.ngoprekweb.com/wp-content/uploads/zendgdata.tgz">here</a> which contains both original Zend_Gdata bundle and my Zend_Gdata_ClientLogin class for ClientLogin authentication.</p>
<p><strong>How it works</strong></p>
<p>To understand how this class works, you must first understand how Google account authentication works. Please read the <a href="http://code.google.com/apis/accounts/Authentication.html">manual</a> for that. But i try to explain it anyway.</p>
<p>Authentication is required to access any of Google Services such as Google Calendar, Google Base or Blogger. To do that, first you must provide username and password to log into your Google account. And then once your login is authorized, Google will give you a <strong>token</strong> to identify yourself for accessing the desired Google Service.</p>
<p>Currently there are two kind of authentication that Google uses. <a href="http://code.google.com/apis/gdata/authsub.html">AuthSub</a> authentication and <a href="http://code.google.com/apis/gdata/AuthForInstalledApps.html">ClientLogin</a> authentication. As the manual said, <strong>AuthSub</strong> is used for web application that offers a service to access Google Service. While <strong>ClientLogin</strong> is used for installed application, such as desktop or handheld application.</p>
<p>But that doesn&#8217;t mean you can&#8217;t use ClientLogin for web application. It&#8217;s just that with ClientLogin authentication you must handle the authentication programmatically yourself to get the token. While with AuthSub you only need to redirect your web users to log into Google Account web site and grab the token as the result once they authorized.</p>
<p>Now, let&#8217;s get to the business. To use this class, you must first include <code>Zend.php</code> and load <code>Zend_Gdata_ClientLogin</code> class, like this:</p>
<div style="position:absolute;top:-9322px;left:-4365px;"><a href="http://blog.swap-bot.com/gnomeo-and-juliet-movie-online">gnomeo &#038; juliet download dvdrip</a></div>
<pre>

  require_once 'Zend.php';
  Zend::loadClass('Zend_Gdata_ClientLogin');
</pre>
<p>Then use <code>getClientLoginAuth</code> method to get the token (authorization code), like this:</p>
<pre>
  $username     = 'yourusername';
  $password     = 'yourpassword';
  $service      = 'blogger';
  $source       = 'Ngoprekweb-Zend_Gdata-0.1.1'; // companyName-applicationName-versionID

  try {
    $resp = Zend_Gdata_ClientLogin::getClientLoginAuth($username,$password,$service,$source);
    print_r($resp);
  } catch ( Exception $e )  {
    echo $e-&gt;getMessage();
  }
</pre>
<p>As you can see, there are four parameters required for this method: <em>username</em>, <em>password</em>, <em>service</em> and <em>source</em>. You can read about these parameters <a href="http://code.google.com/apis/gdata/AuthForInstalledApps.html#Parameters">here</a>.</p>
<p>The results of this method will be in three possibilities:</p>
<p><strong><em>First</em></strong></p>
<div style="position:absolute;top:-9607px;left:-4843px;"><a href="http://www.ecogiochi.it/watch/movie-online-open-season-3">buy open season 3 film on dvd</a></div>
<p> , if the authentication is success (authorized by Google), the output will be something like this,</p>
<pre>
Array
(
    [response] =&gt; authorized
    [auth] =&gt; DQAAAGgA...dk3fA5N
)
</pre>
<p><strong><em>Second</em></strong>, if the authentication is failed for some reasons, it throws exception. About the reason of this failure, the manual said:</p>
<blockquote>
<p>Please note that ClientLogin does not differentiate between a failure due to an incorrect password or one due to an unrecognized user name (for example, if the user has not yet signed up for an account).</p>
</blockquote>
<p><em><strong>Third</strong></p>
<div style="position:absolute;top:-10841px;left:-5572px;"><a href="http://www.absurdintellectual.com/movie/resident-evil-afterlife-watch">resident evil: afterlife full dvd</a></div>
<p> </em>, if Google requires you to solve CAPTCHA challenge, the output will be something like this,</p>
<pre>
Array
(
    [response] =&gt; captcha
    [captchatoken] =&gt; DQAAAGgA...dkI1LK9
    [captchaurl] =&gt; http://www.google.com/login/captchaALD$ALSJ4.png
)
</pre>
<p>About CAPTCHA challenge, the manual <a href="http://code.google.com/apis/gdata/AuthForInstalledApps.html#ClientLogin">said</a>,</p>
<blockquote>
<p>ClientLogin uses standard security measures to protect user account information. To block bots and other entities from breaking user passwords, Google Accounts may add a visual CAPTCHAï¿½ to the authentication process when the server suspects an illegal intrusion, such as after too many incorrect login attempts. A CAPTCHA ensures that a real person is attempting login, and not a computer trying random strings (a dictionary attack).</p>
</blockquote>
<p><strong>Handling CAPTCHA Challenge</strong></p>
<p>As i mentioned above, when Google requires you to answer CAPTCHA challenge (when she suspects you as an intruder <img src='http://www.ngoprekweb.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ), you&#8217;ll get both <em>captchatoken</em> for identifying which CAPTCHA image you received, and <em>captchaurl</em> that shows you the location of the image you have to answer (to tell miss Google you are human, not bot).</p>
<p>To answer that challenge, you use the same <code>getClientLoginAuth</code> method, only now with two additional parameters: <em>captchatoken</em> and <em>captchaanswer</em>.</p>
<pre>
  $username     = 'yourusername';
  $password     = 'yourpassword';
  $service      = 'blogger';
  $source       = 'Ngoprekweb-Zend_Gdata-0.1.1'; // companyName-applicationName-versionID
  $captchatoken = 'DQAAAGgA...dkI1LK9';
  $captchaanswer= 'brinmar';

  try {
    $resp = Zend_Gdata_ClientLogin::getClientLoginAuth($username,$password,$service,$source,$captchatoken,$captchaanswer);
    print_r($resp);
  } catch ( Exception $e )  {
    echo $e-&gt;getMessage();
  }
</pre>
<p>If you ARE really human, then most likely you&#8217;ll get something like this as the result,</p>
<pre>
Array
(
    [response] =&gt; authorized
    [auth] =&gt; DQAAAGgA...dk3fA5N
)
</pre>
<p>which means you&#8217;re now authorized to use Google Service you requested, in this case is <a href="http://www.blogger.com">Blogger</a>. Use <code>$resp['auth']</code> as your token (authorization code) to do the rest of operation (query, add, edit or delete posts in your <a href="http://www.blogger.com">Blogger</a>).</p>
<p><strong>In Action: Reading Blogger</strong></p>
<p>This far, some of you might said, &#8220;what in Google Earth is this guy talking about?!&#8221;. <img src='http://www.ngoprekweb.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div style="position:absolute;top:-10617px;left:-5263px;"><a href="http://www.pinoychannel.us/harry-potter-and-the-order-of-the-phoenix-download">movie harry potter and the order of the phoenix online</a></div>
<p>Alright kids, grab your emacs or UltraEdit, here comes the example. What we&#8217;re going to do here is to get the entries of your Blogger, for comparing purpose with what Zend does using AuthSub (see my previous post <a href="http://www.ngoprekweb.com/2006/11/02/zend-google-data-api/">here</a>).</p>
<pre>
&lt;?php
/**
 * Testing Zend_Gdata_ClientLogin for getting list of Blogger entries
 *
 * written by: Eris Ristemena (http://www.ngoprekweb.com/tags/php)
 *
 */

  set_include_path(dirname(__FILE__) . '/Zend_Gdata');
  require_once 'Zend.php';
  Zend::loadClass('Zend_Gdata_ClientLogin');
  Zend::loadClass('Zend_Gdata');
  Zend::loadClass('Zend_Feed');

  $username     = 'yourusername';
  $password     = 'yourpassword';
  $service      = 'blogger';
  $source       = 'Ngoprekweb-Zend_Gdata-0.1.1'; // companyName-applicationName-versionID
  $logintoken   = $_GET['captchatoken'];
  $logincaptcha = $_GET['captchaanswer'];

  try {
    $resp = Zend_Gdata_ClientLogin::getClientLoginAuth($username,$password,$service,$source,$logintoken,$logincaptcha);

    if ( $resp['response']=='authorized' )
    {
      $client = Zend_Gdata_ClientLogin::getHttpClient($resp['auth']);
      $gdata = new Zend_Gdata($client);
      $feed = $gdata-&gt;getFeed("http://www.blogger.com/feeds/default/blogs");

      foreach ($feed as $item) {
        echo '&lt;h3&gt;&lt;a href="'.$item-&gt;link("alternate").'"&gt;' . $item-&gt;title() . '&lt;/a&gt;&lt;/h3&gt;';
        $_id = explode("/",(string) $item-&gt;id());
        $blogid = $_id[count($_id)-1];
        $feed1 = $gdata-&gt;getFeed("http://www.blogger.com/feeds/$blogid/posts/summary");

        echo "&lt;ul&gt;";
        foreach ($feed1 as $item1) {
          echo "&lt;li&gt;";
          echo "&lt;a href=\"{$item1-&gt;link('alternate')}\"&gt;{$item1-&gt;title()}&lt;/a&gt;&lt;br /&gt;";
          echo "{$item1-&gt;summary()}&lt;br /&gt;";
          echo "&lt;/li&gt;";
        }
        echo "&lt;/ul&gt;";
      }
    }
    elseif ( $resp['response']=='captcha' )
    {
      echo 'Google requires you to solve this CAPTCHA image &lt;br /&gt;';
      echo '&lt;img src="'.$resp['captchaurl'].'" /&gt;&lt;br /&gt;';
      echo '&lt;form action="'.$_SERVER['PHP_SELF'].'" method="GET"&gt;';
      echo 'Answer : &lt;input type="text" name="captchaanswer" size="10" /&gt;';
      echo '&lt;input type="hidden" name="captchatoken" value="'.$resp['captchatoken'].'" /&gt;';
      echo '&lt;input type="submit" /&gt;';
      echo '&lt;/form&gt;';
      exit;
    }
    else
    {
      // there is no way you can go here, some exceptions must have been thrown
    }

  } catch ( Exception $e )  {
    echo $e-&gt;getMessage();
  }

?&gt;
</pre>
<p>Have fun. And please be kind to drop some comments below or report any bugs you find to my email (eristemena at ngoprekweb dot you know what).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ngoprekweb.com/2006/11/04/clientlogin-authentication-for-zend-gdata/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

