<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Sadiqur Rahman</title>
	<atom:link href="http://sadiqbd.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sadiqbd.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Fri, 31 Jul 2009 05:13:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='sadiqbd.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/494878d06d4432c1ae54de44fd27bc6a?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Sadiqur Rahman</title>
		<link>http://sadiqbd.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://sadiqbd.wordpress.com/osd.xml" title="Sadiqur Rahman" />
	<atom:link rel='hub' href='http://sadiqbd.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Get Prepared for ZCE</title>
		<link>http://sadiqbd.wordpress.com/2009/01/31/get-prepared-for-zce/</link>
		<comments>http://sadiqbd.wordpress.com/2009/01/31/get-prepared-for-zce/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 18:38:35 +0000</pubDate>
		<dc:creator>Sadiqur Rahman</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[ZCE]]></category>
		<category><![CDATA[certification]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://sadiqbd.wordpress.com/?p=34</guid>
		<description><![CDATA[Recently I have sate for the ZCE (Zend Certified Engineer) exam on 28 January 2009, And I like to share my experience to all so that everyone can get prepared for ZCE Exam. However, Let me go to the topics. The PHP 5 Certification exam covers the following topics: PHP Basics XML and Web Services Functions [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sadiqbd.wordpress.com&amp;blog=5995666&amp;post=34&amp;subd=sadiqbd&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I have sate for the ZCE (Zend Certified Engineer) exam on 28 January 2009, And I like to share my experience to all so that everyone can get prepared for ZCE Exam. However, Let me go to the topics.</p>
<p>The PHP 5 Certification exam covers the following topics:<br />
PHP Basics<br />
XML and Web Services<br />
Functions<br />
Arrays<br />
Object Oriented Programming<br />
Streams/Network Programming<br />
Design Pattern<br />
PHP 4/5 Differences<br />
Security<br />
Strings and Regular Expression<br />
Databases Access<br />
Web Features</p>
<p>Now let me say where you should study&#8230;</p>
<p><strong>1) PHP Manual</strong> is the best reference to get prepared. This is not only the main reference but you must have deep eye on this tutorial if you are serious to be success. without following PHP Manual it is quite impossible to pass.<br />
I suggest everyone to keep eyes on every functions mentioned into PHP Manual. Array Functions, String Functions and Database (MySQLi, PDO) and Exception handling are notable topics.</p>
<p><strong>2) ZCE Study Guide</strong> You can get from zend.com but remember its not FREE.. you have spend a little money for this guide. You will learn from this guide Basic Language and basic of every topic. specially you will get knowledge from this guide on Security and Design Pattern etc&#8230;</p>
<p><strong>3) Many PHP Forums</strong> You will learn manything from Forums and Newsgroup.</p>
<p><strong>4) Mock Test </strong>Remember there is no similarity between mock and real exam but you will get some idea about your real exam.</p>
<p><strong>5) Confidence </strong>if you do not have enough confidence you do not need to loss your valuable money <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sadiqbd.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sadiqbd.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sadiqbd.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sadiqbd.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sadiqbd.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sadiqbd.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sadiqbd.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sadiqbd.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sadiqbd.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sadiqbd.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sadiqbd.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sadiqbd.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sadiqbd.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sadiqbd.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sadiqbd.wordpress.com&amp;blog=5995666&amp;post=34&amp;subd=sadiqbd&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sadiqbd.wordpress.com/2009/01/31/get-prepared-for-zce/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ce40f64272e63e99d57fb3306a89dad9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sadiqbd</media:title>
		</media:content>
	</item>
		<item>
		<title>HTTP Response Code</title>
		<link>http://sadiqbd.wordpress.com/2009/01/11/http-response-code/</link>
		<comments>http://sadiqbd.wordpress.com/2009/01/11/http-response-code/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 06:43:46 +0000</pubDate>
		<dc:creator>Sadiqur Rahman</dc:creator>
				<category><![CDATA[header]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://sadiqbd.wordpress.com/?p=14</guid>
		<description><![CDATA[Checking the server response code is mainly a diagnostic  tool in case you are getting unexpected results when trying to view a page.  The  response code is sent by the server before the page contents along with other header information like response code, server software, cookies, content type, date etc.. For example, a user had [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sadiqbd.wordpress.com&amp;blog=5995666&amp;post=14&amp;subd=sadiqbd&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Checking the server response code is mainly a diagnostic  tool in case you are getting unexpected results when trying to view a page.  The  response code is sent by the server before the page contents along with other header information like response code, server software, cookies, content type, date etc..</p>
<p>For example, a user had a non existing page which was  showing his site fine but the server was returning a missing page code (404) so  none of the content of this page is actual content you are looking for.</p>
<p>How to send 404 response to the user?<br />
it is very simple.. you have to use header() function to accomplish this.<br />
&lt;?php<br />
header(&#8220;HTTP/1.0 404 Not Found&#8221;);<br />
?&gt;<br />
Other necessary response code&#8230;</p>
<p><pre class="brush: php;">
header(&quot;Location: /foo.php&quot;,TRUE,301);// 301 Moved Permanently
header(&quot;Location: /foo.php&quot;,TRUE,302);// 302 Found
header(&quot;Location: /foo.php&quot;);
header(&quot;Location: /foo.php&quot;,TRUE,303);// 303 See Other
header(&quot;Location: /foo.php&quot;,TRUE,307);// 307 Temporary Redirect
</pre></p>
<p>For more information on header function please keep you eye at http://us2.php.net/header</p>
<p>Anyway, let me expose to my original post..  I was talking on retriving response code.  It can be done by many ways including opening socket and using cURL.<br />
I prefer to use cURL in this case as curl is faster than fsockopen.<br />
Here is a function to retrieve http response header.</p>
<p><pre class="brush: php;">
function get_http_header($url)
      {
          ob_start();
          $ch = curl_init($url);
          curl_setopt($ch, CURLOPT_HEADER, 1);
          curl_setopt($ch, CURLOPT_NOBODY, 1);
          $ok = curl_exec($ch);
          curl_close($ch);
          $head = ob_get_contents();
          ob_end_clean();
          return $head;
      }
</pre></p>
<p>Using this function, you will get all header information including cookies.<br />
Look on the Sample Output of this function</p>
<p>HTTP/1.0 200 OK<br />
Cache-Control: private, max-age=0<br />
Date: Sun, 11 Jan 2009 06:34:42 GMT<br />
Expires: -1<br />
Content-Type: text/html; charset=ISO-8859-1<br />
Set-Cookie: PREF=ID=90215632c8490688:TM=1231655682:<br />
LM=1231655682:S=aYh2YUY8dmUGmQh7;<br />
expires=Tue, 11-Jan-2011 06:34:42 GMT; path=/; domain=.google.com.bd<br />
Server: gws<br />
Content-Length: 0<br />
X-Cache: MISS from mail<br />
Connection: close</p>
<p>Here we need only first line to get response code that is HTTP/1.0 200 OK<br />
So, we can use $head=split(&#8220;\n&#8221;,$head);  to separate first line.<br />
So, our final function will look like</p>
<p><pre class="brush: php;">
function get_http_response_code($url)
      {
          ob_start();
          $ch = curl_init($url);
          curl_setopt($ch, CURLOPT_HEADER, 1);
          curl_setopt($ch, CURLOPT_NOBODY, 1);
          $ok = curl_exec($ch);
          curl_close($ch);
          $head = ob_get_contents();
          ob_end_clean();
          $head=split(&quot;\n&quot;,$head);
          $head=split(&quot; &quot;,$head[0]);
          return $head[1];
      }

</pre></p>
<p>What to Next?<br />
I am showing you all http response code and meaning in a php array.</p>
<p><pre class="brush: php;">
$response_status=array(    100=&gt;&quot;Continue&quot;,
            101=&gt;&quot;Switching Protocol&quot;,
            200=&gt;&quot;OK&quot;,
            201=&gt;&quot;Created&quot;,
            202=&gt;&quot;Accepted&quot;,
            203=&gt;&quot;Non-Authoritative Information&quot;,
            204=&gt;&quot;No Content&quot;,
            205=&gt;&quot;Reset Content&quot;,
            206=&gt;&quot;Partial Content&quot;,
            300=&gt;&quot;Multiple Choices&quot;,
            301=&gt;&quot;Moved Permanently&quot;,
            302=&gt;&quot;Found&quot;,
            303=&gt;&quot;See Other&quot;,
            304=&gt;&quot;Not Modified&quot;,
            305=&gt;&quot;Use Proxy&quot;,
            306=&gt;&quot;Switch Proxy&quot;,
            307=&gt;&quot;Temporary Redirect&quot;,
            400=&gt;&quot;Bad Request&quot;,
            401=&gt;&quot;Unauthorized&quot;,
            402=&gt;&quot;Payment Required&quot;,
            403=&gt;&quot;Forbidden&quot;,
            404=&gt;&quot;Not Found&quot;,
            405=&gt;&quot;Method Not Allowed&quot;,
            406=&gt;&quot;Not Acceptable&quot;,
            407=&gt;&quot;Proxy Authentication Required&quot;,
            408=&gt;&quot;Request Timeout&quot;,
            409=&gt;&quot;Conflict&quot;,
            410=&gt;&quot;Gone&quot;,
            411=&gt;&quot;Length Required&quot;,
            412=&gt;&quot;Precondition Failed&quot;,
            413=&gt;&quot;Request Entity Too Large&quot;,
            414=&gt;&quot;Request-URI Too Long&quot;,
            415=&gt;&quot;Unsupported Media Type&quot;,
            416=&gt;&quot;Requested Range Not Satisfiable&quot;,
            417=&gt;&quot;Expectation Failed&quot;,
            500=&gt;&quot;Internal Server Error&quot;,
            501=&gt;&quot;Not Implemented&quot;,
            502=&gt;&quot;Bad Gateway&quot;,
            503=&gt;&quot;Service Unavailable&quot;,
            504=&gt;&quot;Gateway Timeout&quot;,
            505=&gt;&quot;HTTP Version Not Supported&quot;,
            102=&gt;&quot;Processing&quot;,
            207=&gt;&quot;Multi-Status&quot;,
            418=&gt;&quot;I'm a Teapot&quot;,
            422=&gt;&quot;Unprocessable Entity&quot;,
            423=&gt;&quot;Locked&quot;,
            424=&gt;&quot;Failed Dependency&quot;,
            425=&gt;&quot;Unordered Collection&quot;,
            426=&gt;&quot;Upgrade Required&quot;,
            449=&gt;&quot;Retry With&quot;,
            450=&gt;&quot;Blocked&quot;,
            506=&gt;&quot;Variant Also Negotiates&quot;,
            507=&gt;&quot;Insufficient Storage&quot;,
            509=&gt;&quot;Bandwidth Limit Exceeded&quot;,
            510=&gt;&quot;Not Extended&quot;);
</pre></p>
<p>You can use this array along with above function.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sadiqbd.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sadiqbd.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sadiqbd.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sadiqbd.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sadiqbd.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sadiqbd.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sadiqbd.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sadiqbd.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sadiqbd.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sadiqbd.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sadiqbd.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sadiqbd.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sadiqbd.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sadiqbd.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sadiqbd.wordpress.com&amp;blog=5995666&amp;post=14&amp;subd=sadiqbd&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sadiqbd.wordpress.com/2009/01/11/http-response-code/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ce40f64272e63e99d57fb3306a89dad9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sadiqbd</media:title>
		</media:content>
	</item>
		<item>
		<title>Blogging Started with Wrapper Class for YahooBBAuth</title>
		<link>http://sadiqbd.wordpress.com/2009/01/03/blogging-started-with-wrapper-class-for-yahoobbauth/</link>
		<comments>http://sadiqbd.wordpress.com/2009/01/03/blogging-started-with-wrapper-class-for-yahoobbauth/#comments</comments>
		<pubDate>Sat, 03 Jan 2009 09:39:19 +0000</pubDate>
		<dc:creator>Sadiqur Rahman</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[Yahoo API]]></category>
		<category><![CDATA[YahooBBAuth]]></category>

		<guid isPermaLink="false">http://sadiqbd.wordpress.com/?p=6</guid>
		<description><![CDATA[You already might know that the giant company YAHOO provides some API to facilitate the application development process. One of them is Yahoo BBAuth API. I am glad to inform you that I wrote a wrapper class on Yahoo Browser Based Authentication (BBAuth) to make it easy and convenient. So…, what’s BBAuth? What’s the point [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sadiqbd.wordpress.com&amp;blog=5995666&amp;post=6&amp;subd=sadiqbd&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You already might know that the giant company YAHOO provides some API to facilitate the application development process. One of them is Yahoo BBAuth API. I am glad to inform you that I wrote a wrapper class on Yahoo Browser Based Authentication (BBAuth) to make it easy and convenient.</p>
<p class="MsoNormal" style="text-align:justify;">
<p class="MsoNormal" style="text-align:justify;">So…, what’s BBAuth? What’s the point for using this class?</p>
<p class="MsoNormal" style="text-align:justify;">
<p class="MsoNormal" style="text-align:justify;">Well, a BBAuth API will provide you a WSSID and a cookie which will be destroyed after one hour (idle time) automatically (no way <span style="font-family:Wingdings;"><span>L</span></span> ). After a successful login you will be able to access the users:</p>
<ul>
<li>read and write to your data in Yahoo! Mail</li>
<li>read and write to your data in twlife</li>
<li>read your data in Yahoo! Address Book</li>
<li>read and write to your data in boss</li>
<li>read and write to your data in music</li>
<li>read and write to your data in twk</li>
</ul>
<p class="MsoNormal" style="text-align:justify;"><span style="font-size:9pt;font-family:Tahoma;color:black;"> How it works:</span></p>
<p class="MsoNormal" style="text-align:justify;"><span style="font-size:9pt;font-family:Tahoma;color:black;"> The image below will illustrate the life cycle.<span> </span></span></p>
<div id="attachment_7" class="wp-caption aligncenter" style="width: 419px"><a href="http://developer.yahoo.com/auth/"><img class="size-full wp-image-7" title="bbauth" src="http://sadiqbd.files.wordpress.com/2009/01/bbauth.png?w=480" alt="Yahoo BBauth"   /></a><p class="wp-caption-text">Yahoo BBauth</p></div>
<p class="MsoNormal" style="text-align:justify;"><span style="font-size:9pt;font-family:Tahoma;color:black;"> </span></p>
<p class="MsoNormal" style="text-align:justify;">
<p class="MsoNormal" style="text-align:justify;">Now lemme tell you the entire process:</p>
<p class="MsoNormal" style="text-align:justify;">
<ol style="margin-top:0;" type="1">
<li class="MsoNormal">Register your application</li>
<li class="MsoNormal">Log in your users</li>
<li class="MsoNormal">Use the user&#8217;s credentials to make web service calls</li>
</ol>
<p class="MsoNormal" style="text-align:justify;">
<p class="MsoNormal" style="text-align:justify;">Wrapper Class  class.YahooAuth.php</p>
<p class="MsoNormal" style="text-align:justify;"><a href="http://www.phpclasses.org/browse/package/5069.html">Download from phpClasses.org</a></p>
<p class="MsoNormal" style="text-align:justify;">
<p><pre class="brush: php;">

&lt;?php
/* Description: Class for Yahoo BBAuth API
 * @author: Sadiqur Rahman
 * @param: $AppID=Yahoo BB Authentication Application ID
 * @param: $secret=Yahoo BB Authentication Secret key
 * @param: $AppData=Your application data which is an optional parameter
 * @Links:  http://developer.yahoo.com/auth/
 * @Author-URI: http://sadiqbd.wordpress.com
 * @Author-EMail: sadiqbd@gmail.com
 * License: GPL
 * Version: 1.0.0
 */
//declaring the class
class YahooAuth {

    protected $AppID;
    protected $secret;
    public $AppData;

    function __construct($AppID=NULL,$secret=NULL,$AppData=NULL){

        if (isset($AppID) &amp;&amp; (!empty($AppID))){
            $this-&gt;AppID = $AppID;
        }else{
            global $YahooAppID;
            $this-&gt;AppID = $YahooAppID;
        }

        if (isset($secret) &amp;&amp; (!empty($secret))){
            $this-&gt;AppID = $secret;
        }else{
            global $YahooSecret;
            $this-&gt;secret = $YahooSecret;
        }

        if (isset($AppData) &amp;&amp; (!empty($AppData))){
            $this-&gt;AppData = $AppData;
        }

        if (!headers_sent()) {
            session_start();
        }

    }

    //Signature generation for Yahoo BBAuth
    protected function signature($path,$data,$ts){
        return md5($path.$data.&quot;&amp;ts=&quot;.$ts.$this-&gt;secret);
    }

    //Generating login URL
    function generate_url(){
        $ts=time();
        $path=&quot;/WSLogin/V1/wslogin&quot;;
        $data=&quot;?appid=&quot;.$this-&gt;AppID.&quot;&amp;appdata=&quot;.$this-&gt;AppData;
        $sig=$this-&gt;signature($path,$data,$ts);

        $url = &quot;https://api.login.yahoo.com/WSLogin/V1/wslogin&quot;
        .&quot;?appid=&quot;.$this-&gt;AppID.&quot;&amp;appdata=&quot;.$this-&gt;AppData.&quot;&amp;ts=&quot;.$ts.&quot;&amp;sig=&quot;.$sig;
        return $url;
    }

    //Automatically redirecting Yahoo login page
    function login(){

        if (!headers_sent()) {
            header('Location: '.$this-&gt;generate_url());
            exit;
            // If Header already sent, redirect to Yahoo using Javascript.
        } else {
            echo &quot;&lt;script type=\&quot;text/javascript\&quot;&gt;
                  &lt;!--
                  window.location = \&quot;&quot;.$this-&gt;generate_url().&quot;\&quot;
                  //--&gt;
                  &lt;/script&gt;&quot;.
                  &quot;
&lt;div align='center'&gt;If you are not redirected within 5 Seconds &lt;a &quot; .
                  &quot;href=\&quot;&quot;.$this-&gt;generate_url().&quot;\&quot;&gt;Click Here&lt;/a&gt;&quot;;
            exit;
        }
    }

    //Getting and verifying data from cookie and WSSID given by yahoo
    //and storing data into session for future use
    function get_credentials($token) {
        $ts=time();
        $path=&quot;/WSLogin/V1/wspwtoken_login&quot;;
        $data=&quot;?appid=&quot;.$this-&gt;AppID.&quot;&amp;token=&quot;.$token;
        $sig=$this-&gt;signature($path,$data,$ts);

        $url = &quot;https://api.login.yahoo.com/WSLogin/V1/wspwtoken_login&quot;
        .&quot;?appid=&quot;.$this-&gt;AppID.&quot;&amp;token=&quot;.$token.&quot;&amp;ts=&quot;.$ts.&quot;&amp;sig=&quot;.$sig;

        $ch = curl_init();
        curl_setopt( $ch, CURLOPT_URL, $url );
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
        $store = curl_exec( $ch );
        $xml = curl_exec( $ch );

        if (  preg_match( &quot;/(Y=.*)/&quot;, $xml, $match_array ) == 1 ) {
            $COOKIE = $match_array[1];
        }
        if (  preg_match( &quot;/&lt;WSSID&gt;(.+)&lt;\/WSSID&gt;/&quot;, $xml, $match_array ) == 1 ) {
            $WSSID = $match_array[1];
        }
        if (  preg_match( &quot;/&lt;Timeout&gt;(.+)&lt;\/Timeout&gt;/&quot;, $xml, $match_array ) == 1 ) {
            $timeout = $match_array[1];
        }

        $_SESSION['valid_user']=true;
        $_SESSION['COOKIE'] = $COOKIE;
        $_SESSION['WSSID'] = $WSSID;
        $rv = array();
        $rv[&quot;COOKIE&quot;] = $COOKIE;
        $rv[&quot;WSSID&quot;] = $WSSID;
        $rv[&quot;timeout&quot;]   = $timeout;
        return $rv;
    }

    //some magic methods for your convenience
    function __get($name){
        return $this-&gt;$name;
    }

    function __set($name,$value){
        $this-&gt;$name=$value;
    }

    function __toString(){
        return(var_export($this,TRUE));
    }

    function __destruct(){
        unset($this);
    }
}
?&gt;

</pre></p>
<p class="MsoNormal" style="text-align:justify;">
<p class="MsoNormal" style="text-align:justify;">Example Usage  index.php</p>
<p class="MsoNormal" style="text-align:justify;">
<p><pre class="brush: php;">

&lt;?php

//implementing lazy loading
function __autoload($class){
    include_once(&quot;class.&quot;.$class.&quot;.php&quot;);
}

$YahooAppID=&quot;.lND7LnIkY5jBHPMGmMhBBkWWpbJ6_gew9XLo.B5.d8-&quot;; //your AppID will be here
$YahooSecret=&quot;555060ec4069cf7f67ddb84339f8701c&quot;; //your Secret key goes here

$obj= new YahooAuth(); //Instantiating the class

if (isset($_GET['token']) &amp;&amp; isset($_GET['appid'])){
    $obj-&gt;get_credentials($_GET['token']);
}elseif(isset($_GET['logout'])){
    unset($_SESSION['valid_user']);
}

if ($_SESSION['valid_user']){
    echo &quot;Congratulation! You are logged in.&lt;br \&gt;&quot;;
    echo &quot;&lt;a href='&quot;.$_SERVER['PHP_SELF'].&quot;?logout'&gt;LogOut&lt;/a&gt;&lt;br \&gt;&quot;;
    echo &quot;
&lt;pre&gt;&quot;;
    print_r($_SESSION);
    echo &quot;&lt;/pre&gt;
&quot;;
}else{
    echo &quot;You are not logged in.&lt;br \&gt;&quot;;
    echo &quot;&lt;a href='&quot;.$obj-&gt;generate_url().&quot;'&gt;Click Here to logIn&lt;/a&gt;&quot;;
}
?&gt;

</pre></p>
<p><a href="http://www.phpclasses.org/browse/package/5069.html">Download from phpclasses.org</a></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sadiqbd.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sadiqbd.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sadiqbd.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sadiqbd.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sadiqbd.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sadiqbd.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sadiqbd.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sadiqbd.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sadiqbd.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sadiqbd.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sadiqbd.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sadiqbd.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sadiqbd.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sadiqbd.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sadiqbd.wordpress.com&amp;blog=5995666&amp;post=6&amp;subd=sadiqbd&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sadiqbd.wordpress.com/2009/01/03/blogging-started-with-wrapper-class-for-yahoobbauth/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ce40f64272e63e99d57fb3306a89dad9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sadiqbd</media:title>
		</media:content>

		<media:content url="http://sadiqbd.files.wordpress.com/2009/01/bbauth.png" medium="image">
			<media:title type="html">bbauth</media:title>
		</media:content>
	</item>
	</channel>
</rss>
