<?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>blog.watashii &#187; php</title>
	<atom:link href="http://blog.watashii.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.watashii.com</link>
	<description></description>
	<lastBuildDate>Fri, 03 Sep 2010 07:15:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Display WordPress Unicoded Characters</title>
		<link>http://blog.watashii.com/2008/12/display-wordpress-unicoded-characters/</link>
		<comments>http://blog.watashii.com/2008/12/display-wordpress-unicoded-characters/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 10:01:14 +0000</pubDate>
		<dc:creator>watashii</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[unicode]]></category>

		<guid isPermaLink="false">http://blog.watashii.com/?p=132</guid>
		<description><![CDATA[Recently upgraded my WP blog, and released some japanese/chinese characters (in Unicode) were displaying strangely, giving me question marks (????) and funny symbols (ãƒˆãƒˆãƒ).
I learnt that this can be fixed by modifying the WP source file wp-config.php on the web server.  The change required is simply commenting the following 2 lines of code,  by adding [...]


Related Posts:<ol><li><a href='http://blog.watashii.com/2008/12/upgrading-to-wordpress-27-coltrane/' rel='bookmark' title='Permanent Link: Upgrading to WordPress 2.7 Coltrane'>Upgrading to WordPress 2.7 Coltrane</a></li>
<li><a href='http://blog.watashii.com/2009/09/wordpress-code-at-the-end-of-urls-hack/' rel='bookmark' title='Permanent Link: WordPress Code At The End Of URLs, Hack?'>WordPress Code At The End Of URLs, Hack?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Recently upgraded my WP blog, and released some japanese/chinese characters (in Unicode) were displaying strangely, giving me question marks (????) and funny symbols (ãƒˆãƒˆãƒ).</p>
<p>I learnt that this can be fixed by modifying the WP source file <em>wp-config.php</em> on the web server.  The change required is simply commenting the following 2 lines of code,  by adding a // in front of:</p>
<pre><code>/** Database Charset to use in creating database tables. */
<strong>//</strong>define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
<strong>//</strong>define('DB_COLLATE', '');
</code></pre>


<p>Related Posts:<ol><li><a href='http://blog.watashii.com/2008/12/upgrading-to-wordpress-27-coltrane/' rel='bookmark' title='Permanent Link: Upgrading to WordPress 2.7 Coltrane'>Upgrading to WordPress 2.7 Coltrane</a></li>
<li><a href='http://blog.watashii.com/2009/09/wordpress-code-at-the-end-of-urls-hack/' rel='bookmark' title='Permanent Link: WordPress Code At The End Of URLs, Hack?'>WordPress Code At The End Of URLs, Hack?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.watashii.com/2008/12/display-wordpress-unicoded-characters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook API Apps &#8211; Get Your User&#8217;s Info</title>
		<link>http://blog.watashii.com/2008/09/facebook-api-apps-get-your-users-info/</link>
		<comments>http://blog.watashii.com/2008/09/facebook-api-apps-get-your-users-info/#comments</comments>
		<pubDate>Sat, 06 Sep 2008 13:10:57 +0000</pubDate>
		<dc:creator>watashii</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.watashii.com/?p=62</guid>
		<description><![CDATA[When developing facebook applications, you generally would like to obtain some basic information about a user.  To do this, we use the facebook API function Users.getStandardInfo.  See first lesson for an introduction to creating facebook applications.  Note, this will only work if the user has granted your application to access their information.

Your facebook application, php [...]


Related Posts:<ol><li><a href='http://blog.watashii.com/2008/09/make-your-first-facebook-application-in-10-minutes/' rel='bookmark' title='Permanent Link: Make Your First Facebook Application in 10 Minutes'>Make Your First Facebook Application in 10 Minutes</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.watashii.com/wp-content/uploads/2008/09/wiki_logo.png" alt="" title="fb_wiki_logo" width="90" height="113" class="float-left size-full wp-image-61" />When developing facebook applications, you generally would like to obtain some basic information about a user.  To do this, we use the facebook API function <a href="http://wiki.developers.facebook.com/index.php/Users.getStandardInfo">Users.getStandardInfo</a>.  See <a href="http://blog.watashii.com/2008/09/make-your-first-facebook-application-in-10-minutes/">first lesson for an introduction to creating facebook applications</a>.  Note, this will only work if the user has granted your application to access their information.</p>
<p><span id="more-62"></span><br />
Your facebook application, php hosted, would have authenticated with an api and secret key.  The id of the user using your application would also have been obtained as follows:</p>
<pre name="code" class="php">
$appapikey = '&lt;your_api_key_here&gt;';
$appsecret = '&lt;your_secret_key_here&gt;';
$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook-&gt;require_login();
</pre>
<p>Passing this user_id, and a list of details we want facebook to return back to us (inside an array), we now can use the getStandardInfo api call to retreive their details:</p>
<pre name="code" class="php">
$user_details=$facebook-&gt;api_client-&gt;users_getStandardInfo($user_id, array('uid','last_name','first_name','name','sex','birthday','timezone','locale','affiliations'));
</pre>
<p>Thereafter, the results are fetched within an associative array:</p>
<pre name="code" class="php">
print $user_details[0]['uid'];
print $user_details[0]['first_name'];
print $user_details[0]['last_name'];
print $user_details[0]['name';
...
</pre>
<p>And so forth&#8230; You can also use this api call over an array of user id&#8217;s, to grab details of multiple users at one go.</p>


<p>Related Posts:<ol><li><a href='http://blog.watashii.com/2008/09/make-your-first-facebook-application-in-10-minutes/' rel='bookmark' title='Permanent Link: Make Your First Facebook Application in 10 Minutes'>Make Your First Facebook Application in 10 Minutes</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.watashii.com/2008/09/facebook-api-apps-get-your-users-info/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Make Your First Facebook Application in 10 Minutes</title>
		<link>http://blog.watashii.com/2008/09/make-your-first-facebook-application-in-10-minutes/</link>
		<comments>http://blog.watashii.com/2008/09/make-your-first-facebook-application-in-10-minutes/#comments</comments>
		<pubDate>Sat, 06 Sep 2008 10:18:13 +0000</pubDate>
		<dc:creator>watashii</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.watashii.com/?p=54</guid>
		<description><![CDATA[
This tutorial will show you how to create your very own facebook application by displaying some random text on a users profile.
This is suited for those beginning with their first application on facebook.
Prerequisites
- A facebook account
- A webserver to host the application contents, with PHP 5 support
- The PHP 5 client library or my sample [...]


Related Posts:<ol><li><a href='http://blog.watashii.com/2008/09/facebook-api-apps-get-your-users-info/' rel='bookmark' title='Permanent Link: Facebook API Apps &#8211; Get Your User&#8217;s Info'>Facebook API Apps &#8211; Get Your User&#8217;s Info</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img class="float-left size-full wp-image-61" title="fb_wiki_logo" src="http://blog.watashii.com/wp-content/uploads/2008/09/wiki_logo.png" alt="" width="90" height="113" /><br />
This tutorial will show you how to create your very own facebook application by displaying some random text on a users profile.</p>
<p>This is suited for those beginning with their first application on facebook.</p>
<h3>Prerequisites</h3>
<p>- A facebook account<br />
- A webserver to host the application contents, with PHP 5 support<br />
- The <a href="http://svn.facebook.com/svnroot/platform/clients/packages/facebook-platform.tar.gz">PHP 5 client library</a> or <a href="http://blog.watashii.com/wp-content/uploads/2008/08/facebook_app.zip">my sample application files</a> to be installed on the webserver, as starting point.<a href="http://blog.watashii.com/wp-content/uploads/2008/08/facebook_app.zip"> </a></p>
<p><span id="more-54"></span></p>
<h3>Setting Up The Application</h3>
<p>The first step is to register and setup your application details on facebook to obtain the API/secret keys.  Enable the <a href="http://www.new.facebook.com/developers">facebook developer application</a>, and click on &#8220;setup new application&#8221;.  Give it an application name, tick to acccept the terms of service, expand the &#8220;optional fields&#8221;, and fill in the &#8220;callback url&#8221; with the destination of your webserver&#8217;s php files of the application.</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-55" title="facebook01" src="http://blog.watashii.com/wp-content/uploads/2008/08/facebook01.png" alt="" width="497" height="393" /></p>
<h3>Obtain the API Key</h3>
<p style="text-align: left;">Press ok, and the next screen will provide you with an API key and secret key to use on your application.  Thats all the things you need to do on facebook!</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-56" title="facebook02" src="http://blog.watashii.com/wp-content/uploads/2008/08/facebook02.png" alt="" width="487" height="707" /></p>
<h3>Writing the Application</h3>
<p>Load the facebook php client library files into the callback url location that we&#8217;ve provided, under the include directory.  Then we will create a new index.php file, which will display our application contents.  The first part of the code is easy, just fill in the API and secret key obtained above to create a facebook object.  The user_id provides us with the current logged in user, which will be used to set the app&#8217;s profile box text later on.</p>
<pre name="code" class="php">&lt;?php
require_once 'includes/facebook.php';

$appapikey = '&lt;your_api_key_here&gt;';
$appsecret = '&lt;your_secret_key_here&gt;';
$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook-&gt;require_login();
$callbackurl = 'http://www.watashii.com/watashii/';
?&gt;</pre>
<p>The next part of the code simply prints out some HTML (FBML, actually) which will be displayed in the facebook canvas page.  No specific facebook API calls were used, so this is pretty straightforward.  Note that CSS must be embeded within the HTML text.</p>
<pre name="code" class="php">//initialize an array of quotes
$quotes= array("Hellooooo World!!",
"A banana a day, keeps the monkeys underpay",
"This is my first facebook app, what a waste of time!!"
);

//select a random quote
$i= rand(0, sizeof($quotes)-1);

//prints on the canvas page
print ('
&lt;style type="text/css"&gt;
h1{ margin: 10px; font-size: 24pt; }
h2{ margin: 15px; font-size: 20pt; }
&lt;/style&gt;
');

print "&lt;h1&gt;Watashii Says:&lt;/h1&gt;";
print "&lt;h2&gt;". $quotes[$i] ."&lt;/h2&gt;";</pre>
<p>The other part of the code will populate the application profile box using profile_setFBML.   We generate the same text (FBML) on the profile box, using the user_id value of the profile viewer.</p>
<pre name="code" class="php">//prints on profile box
$text= ('
&lt;style type="text/css"&gt;
h1{ margin: 10px; font-size: 24pt; }
h2{ margin: 15px; font-size: 20pt; }
&lt;/style&gt;
');

$text.=('&lt;h2&gt;'. $quotes[$i] .'&lt;/h2&gt;');

//facebook api call to set the profile box (Updated on 2008-11-02, see end of post)
$facebook-&gt;api_client-&gt;profile_setFBML($text, $user_id, $text, $text, $text, $text);</pre>
<h3>Results</h3>
<p style="text-align: left;">The Canvas page</p>
<p style="text-align: left;"><img class="alignnone size-full wp-image-58" title="facebook04" src="http://blog.watashii.com/wp-content/uploads/2008/08/facebook04.png" alt="" width="500" height="134" /></p>
<p>The profile box</p>
<p><img class="alignnone size-full wp-image-57" title="facebook03" src="http://blog.watashii.com/wp-content/uploads/2008/08/facebook03.png" alt="" width="238" height="301" /></p>
<p style="text-align: left;">And there we have, our very first facebook application.  Of course this is just a very very basic application, and there are plenty of stuff we can do.  Check out the <a href="http://wiki.developers.facebook.com/index.php/Main_Page">facebook platform documentation</a> and other <a href="http://www.new.facebook.com/developers/">resources</a> for your quest to creating your next cool app!</p>
<p style="text-align: left;"><strong>[Updated 2008-11-02] : </strong></p>
<p style="text-align: left;">The new facebook layout was able to show my FBML box on the &#8220;box tab&#8221;, but gave me the following error on the &#8220;profile tab&#8221;:</p>
<blockquote>
<p style="text-align: left;">No content to display. This box will not be visible to people who view your profile until this application adds content to it.</p>
</blockquote>
<p style="text-align: left;">Then i realised i had to pass 6 arguments in <em>Profile.setFBML</em> (before i only passed the first 2, that was probably set from the old facebook layout).   The <a href="http://wiki.developers.facebook.com/index.php/Profile.setFBML" target="_blank">wiki page</a> example listed 5 arguments and didnt work for me, so watch out! </p>


<p>Related Posts:<ol><li><a href='http://blog.watashii.com/2008/09/facebook-api-apps-get-your-users-info/' rel='bookmark' title='Permanent Link: Facebook API Apps &#8211; Get Your User&#8217;s Info'>Facebook API Apps &#8211; Get Your User&#8217;s Info</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.watashii.com/2008/09/make-your-first-facebook-application-in-10-minutes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
