<?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>Seichleon</title>
	<atom:link href="http://seich.martianwabbit.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://seich.martianwabbit.com</link>
	<description>Legendarido...</description>
	<lastBuildDate>Thu, 04 Mar 2010 06:45:17 +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>Installing PHP on your computer&#8230;</title>
		<link>http://seich.martianwabbit.com/installing-php-on-your-computer/</link>
		<comments>http://seich.martianwabbit.com/installing-php-on-your-computer/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 06:43:14 +0000</pubDate>
		<dc:creator>Seich</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://seich.martianwabbit.com/?p=206</guid>
		<description><![CDATA[Okay, so you are probably wondering what&#8217;s required to start working with PHP. Well there isn&#8217;t much to it. In the following video I&#8217;ll cover the installation of EasyPHP a WAMP( Windows + Apache + Mysql + PHP) solution with a pretty straight forward installation.

Please notice that I use windows for my php development screencasts. [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, so you are probably wondering what&#8217;s required to start working with PHP. Well there isn&#8217;t much to it. In the following video I&#8217;ll cover the installation of EasyPHP a WAMP( Windows + Apache + Mysql + PHP) solution with a pretty straight forward installation.</p>
<p><embed src="http://blip.tv/play/haEEgcq5OAA%2Em4v" type="application/x-shockwave-flash" width="400" height="294" allowscriptaccess="always" allowfullscreen="true"></embed></p>
<p>Please notice that I use windows for my php development screencasts. If you are using linux or Mac Os you&#8217;ll need to install their respective software bundles. I recommend you check the following links.</p>
<p>Mac Os: <a href="http://www.mamp.info/en/index.html">http://www.mamp.info/en/index.html</a></p>
<p>Linux(Ubuntu): <a href="http://www.howtoforge.com/ubuntu_lamp_for_newbies">http://www.howtoforge.com/ubuntu_lamp_for_newbies</a></p>
<p>Feel free to ask any question you may have, I gladly answer them ASAP.</p>
]]></content:encoded>
			<wfw:commentRss>http://seich.martianwabbit.com/installing-php-on-your-computer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How PHP works</title>
		<link>http://seich.martianwabbit.com/how-php-works/</link>
		<comments>http://seich.martianwabbit.com/how-php-works/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 03:19:47 +0000</pubDate>
		<dc:creator>Seich</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Screencast]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[php Tutorial]]></category>

		<guid isPermaLink="false">http://seich.martianwabbit.com/?p=198</guid>
		<description><![CDATA[Okay, this won&#8217;t be of much help to everyone but those following my new screencast series about PHP.  I&#8217;ll be going over the basics and I thought that this would be the best place to start on. &#8220;How PHP works&#8221; shows in about a minute the basic functionality of PHP. I&#8217;ll be going over setting [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, this won&#8217;t be of much help to everyone but those following my new screencast series about PHP.  I&#8217;ll be going over the basics and I thought that this would be the best place to start on. &#8220;How PHP works&#8221; shows in about a minute the basic functionality of PHP. I&#8217;ll be going over setting PHP up in your PC afterwards and then I&#8217;ll start showing the basics of PHP. Hopefully this screencast series will give me a reason to be more active on my blog.</p>
<p><embed src="http://blip.tv/play/haEEgcfCfAA%2Em4v" type="application/x-shockwave-flash" width="400" height="294" allowscriptaccess="always" allowfullscreen="true"></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://seich.martianwabbit.com/how-php-works/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ceica Pastebin</title>
		<link>http://seich.martianwabbit.com/ceica-pastebin/</link>
		<comments>http://seich.martianwabbit.com/ceica-pastebin/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 04:45:18 +0000</pubDate>
		<dc:creator>Seich</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://seich.martianwabbit.com/?p=186</guid>
		<description><![CDATA[I&#8217;ve finally completed (sort of) a project. I created the Ceica Pastebin based upon the idea of pastebin.com. I really liked the idea behind it and thought it would be something really cool to script. Just as I predicted I had a great time doing it. It&#8217;s fully functional except for the API I am [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally completed (sort of) a project. I created the <a href="http://bin.martianwabbit.com">Ceica Pastebin</a> based upon the idea of pastebin.com. I really liked the idea behind it and thought it would be something really cool to script. Just as I predicted I had a great time doing it. It&#8217;s fully functional except for the API I am planning on releasing. The way everything runs should be able to handle extreme quantities of traffic and usage that it won&#8217;t be getting so I can rely on my server not crashing. I really love how it turned out and I think my implementation is really elegant. It&#8217;s opensource by request so if you want to take a look at it feel free to ask for a copy by contacting me. I would personally download pastebin.com&#8217;s script as it&#8217;s been developed way more than my 7hour project. I&#8217;ll be improving it and I have plans for several desktop applications to help provide a smoother connection between the user and the service.</p>
<p>I still have many ideas I would like to develop. Like user registration with features like keeping track of posts and link emailing. I am still thinking on ways to improve it. I will also redesign it&#8217;s ui as it isn&#8217;t nice enough. I hope it&#8217;s useful for someone and that it actually gets used.  <a href="http://martianwabbit.com/about.html">Contact me</a> if you have any doubt or if you spot any bug. Please comment about it xD.</p>
<p><a href="http://bin.martianwabbit.com"><img class="alignnone size-medium wp-image-187" title="Ceica PasteBin_1255919077675" src="http://seich.martianwabbit.com/wp-content/uploads/2009/10/Ceica-PasteBin_1255919077675-300x186.png" alt="Ceica PasteBin_1255919077675" width="300" height="186" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://seich.martianwabbit.com/ceica-pastebin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a Simple Twitter PHP Class</title>
		<link>http://seich.martianwabbit.com/building-a-simple-twitter-php-class/</link>
		<comments>http://seich.martianwabbit.com/building-a-simple-twitter-php-class/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 22:01:55 +0000</pubDate>
		<dc:creator>Seich</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[php Tutorial]]></category>

		<guid isPermaLink="false">http://seich.martianwabbit.com/?p=149</guid>
		<description><![CDATA[
PHP is a very versatile scripting language. In this tutorial I will be explaining how to create a PHP class that will help you post and get information from a twitter account using the client URL library (cURL).

Tutorial Details

Program: PHP/Twitter API
Version: 1
Difficulty: Easy
Estimated Completion Time: 10 minutes

Step 1 &#8211; Starting up
Let&#8217;s begin. First, we will [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://seich.martianwabbit.com/wp-content/uploads/2009/08/preview.jpg"><img class="alignnone size-full wp-image-150" title="preview" src="http://seich.martianwabbit.com/wp-content/uploads/2009/08/preview.jpg" alt="preview" width="200" height="200" /></a></p>
<p>PHP is a very versatile scripting language. In this tutorial I will be explaining how to create a PHP class that will help you post and get information from a twitter account using the client URL library (cURL).</p>
<p><span id="more-149"></span></p>
Note: There is a file embedded within this post, please visit this post to download the file.
<h3>Tutorial Details</h3>
<ul>
<li><strong>Program:</strong> PHP/Twitter API</li>
<li><strong>Version:</strong> 1</li>
<li><strong>Difficulty:</strong> Easy</li>
<li><strong>Estimated Completion Time:</strong> 10 minutes</li>
</ul>
<h3>Step 1 &#8211; Starting up</h3>
<p>Let&#8217;s begin. First, we will create a file named twit.php which will contain our class. Once created, we declare our class and name it twit.</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #000000; font-weight: bold;">class</span> twit <span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//define class &quot;twit&quot;</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<h3>Step 2 &#8211; The Constructor</h3>
<p>We will now add our class&#8217;s public variables and its constructor. The constructor is a special function that will be run when we create a new instance of the class.</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #000000; font-weight: bold;">class</span> twit <span style="color: #009900;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$username</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$password</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$username</span><span style="color: #339933;">,</span> <span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">username</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$username</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">password</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$password</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>Now we have defined the two variables that we will be using throughout the class. These will be defined when a new instance of the class is created, thanks to our __construct method.</p>
<h3>Step 3 &#8211; Posting</h3>
<p>It&#8217;s time to define our first method.</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #000000; font-weight: bold;">class</span> twit <span style="color: #009900;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$username</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$password</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$username</span><span style="color: #339933;">,</span> <span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">username</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$username</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">password</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$password</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">function</span> postStatus<span style="color: #009900;">&#40;</span><span style="color: #000088;">$tweet</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/curl_init"><span style="color: #990000;">curl_init</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//initiate curl session.</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #0000ff;">'http://www.twitter.com/statuses/update.xml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//set URL to connect to.</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_CONNECTTIMEOUT<span style="color: #339933;">,</span> 2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> 1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_POST<span style="color: #339933;">,</span> 1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//set mode to POST.</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_POSTFIELDS<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;status=&quot;</span><span style="color: #339933;">.</span><a href="http://www.php.net/urlencode"><span style="color: #990000;">urlencode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tweet</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//send status information.</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_USERPWD<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$this-&gt;username</span>:<span style="color: #006699; font-weight: bold;">$this-&gt;password</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//send login information.</span><br />
<br />
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/curl_exec"><span style="color: #990000;">curl_exec</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//execute curl session.</span><br />
<span style="color: #000088;">$http_status</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/curl_getinfo"><span style="color: #990000;">curl_getinfo</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLINFO_HTTP_CODE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//get response code.</span><br />
<br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$http_status</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">200</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//200 means the post was succesful.</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<a href="http://www.php.net/curl_close"><span style="color: #990000;">curl_close</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//close curl connection.</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>The postStatus method will be used to tweet directly to our account, to achieve this we use the cURL to post using twitter&#8217;s api. The setup is simple and configured as specified on the twitter api page. The method returns true or false based upon the response code sent back from twitter this, makes the class easier to be used within another page in order to display success/error messages or trigger some other action.</p>
<p>Let&#8217;s try our class and see what we have so far.<br />
Create another php file and try the following code in it. Make sure to replace USER and PASSWORD with your twitter username and password.</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;twit.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$twitter</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> twit<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;USER&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;PASSWORD&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//replace these</span><br />
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$twitter</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">postStatus</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Test!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Status Posted!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;There was an error when posting the status to twitter.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<p>If everything is working correctly you should see the post on your twitter account and it should appear as posted through the API.</p>
<p><a href="http://seich.martianwabbit.com/wp-content/uploads/2009/08/1.jpg"><img class="alignnone size-full wp-image-156" title="1" src="http://seich.martianwabbit.com/wp-content/uploads/2009/08/1.jpg" alt="1" width="600" height="80" /></a></p>
<h3>Step 4 &#8211; Getting</h3>
<p>Finally, we will define our second and last method which, is going to help us get the information of our last twitter status.</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #000000; font-weight: bold;">class</span> twit <span style="color: #009900;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$username</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$password</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$username</span><span style="color: #339933;">,</span> <span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">username</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$username</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">password</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$password</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">function</span> postStatus<span style="color: #009900;">&#40;</span><span style="color: #000088;">$tweet</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/curl_init"><span style="color: #990000;">curl_init</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #0000ff;">'http://www.twitter.com/statuses/update.xml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_CONNECTTIMEOUT<span style="color: #339933;">,</span> 2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> 1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_POST<span style="color: #339933;">,</span> 1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_POSTFIELDS<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;status=&quot;</span><span style="color: #339933;">.</span><a href="http://www.php.net/urlencode"><span style="color: #990000;">urlencode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tweet</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_USERPWD<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$this-&gt;username</span>:<span style="color: #006699; font-weight: bold;">$this-&gt;password</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/curl_exec"><span style="color: #990000;">curl_exec</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$http_status</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/curl_getinfo"><span style="color: #990000;">curl_getinfo</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLINFO_HTTP_CODE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$http_status</span> <span style="color: #339933;">==</span> 200<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<a href="http://www.php.net/curl_close"><span style="color: #990000;">curl_close</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">function</span> getStatus<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/curl_init"><span style="color: #990000;">curl_init</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #0000ff;">'http://twitter.com/statuses/user_timeline/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">username</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.xml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//set url to the user's timeline.</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_VERBOSE<span style="color: #339933;">,</span> 0<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> 1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_USERPWD<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$this-&gt;username</span>:<span style="color: #006699; font-weight: bold;">$this-&gt;password</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_HTTP_VERSION<span style="color: #339933;">,</span> CURL_HTTP_VERSION_1_1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_CONNECTTIMEOUT<span style="color: #339933;">,</span> 5<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_GET<span style="color: #339933;">,</span> 1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//set mode to get.</span><br />
<br />
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/curl_exec"><span style="color: #990000;">curl_exec</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$http_status</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/curl_getinfo"><span style="color: #990000;">curl_getinfo</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLINFO_HTTP_CODE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<a href="http://www.php.net/curl_close"><span style="color: #990000;">curl_close</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$http_status</span> <span style="color: #339933;">!=</span> 200<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000088;">$resultArray</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/simplexml_load_string"><span style="color: #990000;">simplexml_load_string</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//load the result into a simplexml object.</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$resultArray</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">status</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//return object.</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>This time we will be using the cURL&#8217;s get option, which will allow us to get the information from the twitter server.<br />
In this method I am using a simplexml object to make the task of managing information easier, since we will be receiving a lot of data from the server.</p>
<p>Let&#8217;s try the new method out! Create a new PHP file and insert the following code into it. Once again, make sure to replace USER and PASSWORD with your corresponding twitter username and password.</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;twit.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$twitter</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> twit<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;USER&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;PASSWORD&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//replace these</span><br />
<span style="color: #000088;">$tweeter2</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tweeter</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getStatus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/var_dump"><span style="color: #990000;">var_dump</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tweeter2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<div class="tutorial_image"><a href="http://seich.martianwabbit.com/wp-content/uploads/2009/08/2.jpg"><img class="alignnone size-full wp-image-157" title="2" src="http://seich.martianwabbit.com/wp-content/uploads/2009/08/2.jpg" alt="2" width="600" height="213" /></a></div>
<p>You will get a lot of data, but since it&#8217;s stored in a simplexml object it is quite easy to manipulate it.<br />
For example, if you wanted to get the text from your last post you could use:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;twit.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$tweeter</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> twit<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Seich&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;password&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tweeter</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getStatus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<p>Which would echo whatever you wrote in your last update. Using this same method you can access all of the data provided.</p>
<h3>Conclusion</h3>
<p>Twitter&#8217;s API is quite easy to manipulate. It is a very repetitive task though, so an object-oriented approach can help us making the process easier. Using these two methods as example, you should be able to expand the class or create your own approach to it. Nevertheless you should now be able to play with the Twitter API and manipulate Twitter&#8217;s data.</p>
<h3>Further reading</h3>
<p>I would recommend reading these in order to get a deeper view of what we covered in this tutorial.</p>
<ul>
<li><a href="http://php.net/curl">PHP Client URL Library Manual</a></li>
<li><a href="http://apiwiki.twitter.com/">Twitter API Wiki</a></li>
<li><a href="http://php.net/simplexml">PHP SimpleXML Object Manual</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://seich.martianwabbit.com/building-a-simple-twitter-php-class/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Learning Photoshop Keys, MWPS Style</title>
		<link>http://seich.martianwabbit.com/learning-photoshop-keys-mwps-style/</link>
		<comments>http://seich.martianwabbit.com/learning-photoshop-keys-mwps-style/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 05:59:09 +0000</pubDate>
		<dc:creator>Seich</dc:creator>
				<category><![CDATA[CheatBoard]]></category>

		<guid isPermaLink="false">http://seich.martianwabbit.com/?p=144</guid>
		<description><![CDATA[Okay, so recently I decided that I will start posting on this blog more frequently as well as, increasing the quality of the content and that stuff. Today I was busy memorizing Photoshop keys. Mainly because, I&#8217;ve used photoshop for quite a while and never learned all of the basic tool keys. After googling &#8220;photoshop [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, so recently I decided that I will start posting on this blog more frequently as well as, increasing the quality of the content and that stuff. Today I was busy memorizing Photoshop keys. Mainly because, I&#8217;ve used photoshop for quite a while and never learned all of the basic tool keys. After googling &#8220;photoshop cheatsheet&#8221; I found out that the only acceptable one is both not a sheet and useless for this purpose. Thus, I started a quest and began designing a basic image to help me with this purpose.I decided that one that resembled the keyboard layout would be the easiest to follow and that originated it&#8217;s appearance. Took around 30mins to make. I am still planning some improvements and, I might transform it into a full cheatsheet. I don&#8217;t know yet. Here it is:</p>
<div id="attachment_146" class="wp-caption aligncenter" style="width: 710px"><a href="http://seich.martianwabbit.com/wp-content/uploads/2009/07/ps-keyboard.png"><img class="size-full wp-image-146" title="ps-keyboard" src="http://seich.martianwabbit.com/wp-content/uploads/2009/07/ps-keyboard.png" alt="Photoshop Hotkey Map." width="700" height="217" /></a><p class="wp-caption-text">Photoshop Hotkey Map.</p></div>
<p>I already started using it and it actually made learning these easier. <img src='http://seich.martianwabbit.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  please comment if you like it and if you don&#8217;t still do so.</p>
]]></content:encoded>
			<wfw:commentRss>http://seich.martianwabbit.com/learning-photoshop-keys-mwps-style/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The annual MWPS revamp.</title>
		<link>http://seich.martianwabbit.com/the-annual-mwps-revamp/</link>
		<comments>http://seich.martianwabbit.com/the-annual-mwps-revamp/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 15:41:15 +0000</pubDate>
		<dc:creator>Seich</dc:creator>
				<category><![CDATA[MWPS]]></category>

		<guid isPermaLink="false">http://seich.martianwabbit.com/?p=136</guid>
		<description><![CDATA[Okay after 3 days of hard work (not so hard actually) I&#8217;ve made a very nice new face for Martian Wabbit Productions. This time I am no longer presenting myself as the design firm I&#8217;ve been over the past years instead, I&#8217;ve restructured what MWPS is. It will still act as a brand but, instead [...]]]></description>
			<content:encoded><![CDATA[<p>Okay after 3 days of hard work (not so hard actually) I&#8217;ve made a very nice new face for Martian Wabbit Productions. This time I am no longer presenting myself as the design firm I&#8217;ve been over the past years instead, I&#8217;ve restructured what MWPS is. It will still act as a brand but, instead of representing the company, it will represent me and what will me and my company (Martian Wabbit Productions)  be. I love what the result ended up being. It is in it&#8217;s pure form a sketch. This is the first website I&#8217;ve placed this kind of effort into. The development process (was inspired by my friend Edward) was basically drawing as much as I could in a piece of paper then, I would scan it, change the brightness and contrast of the scanned paper. Clean the scan as much as possible and then optimize it for the web. It ended up being pretty neat and sketchy. I also made a nice brush set out of it (I will be uploading this one later on) which, allowed me to reuse my previous drawing.</p>
<p>The content is basically the same format as the old site but, it&#8217;s theme is different. I am no longer looking for a job but showing everyone who comes into the site who am I and what I do. The portfolio is the only page that I think is missing stuff so, I will be editing it later on. I will be adding information about the presented project and my other projects as well. The about page is probably the most unprofessional part of the page (which is what I am looking for with the general look of the new site). It features no about me info and, I actually slashed that through. I wrote contact me next to it so I could fix the identity issue <img src='http://seich.martianwabbit.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  and developed a nice web form.  It&#8217;s powered with ajax and features real-time field value checking and Ajax submit, on the back-end I have a simple and very well structured php script. This script basically double checks the submitted information and emails it to me (It also features some anti-spam technology of mine <img src='http://seich.martianwabbit.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> ). I am only missing my custom-made matching wordpress theme (which I am already working on) so you should see a change in the blog if you come on later this week <img src='http://seich.martianwabbit.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p>That&#8217;s basically it. I also customized my 404 error pages <img src='http://seich.martianwabbit.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> . I also made this image to give you a tour.</p>
<div id="attachment_140" class="wp-caption aligncenter" style="width: 434px"><a href="http://seich.martianwabbit.com/wp-content/uploads/2009/07/mwps2009.gif"><img class="size-full wp-image-140" title="mwps2009" src="http://seich.martianwabbit.com/wp-content/uploads/2009/07/mwps2009.gif" alt="MWPS 2009 Site Tour" width="424" height="800" /></a><p class="wp-caption-text">MWPS 2009 Site Tour</p></div>
]]></content:encoded>
			<wfw:commentRss>http://seich.martianwabbit.com/the-annual-mwps-revamp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firefox 3.5 Released</title>
		<link>http://seich.martianwabbit.com/firefox-35-released/</link>
		<comments>http://seich.martianwabbit.com/firefox-35-released/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 17:05:58 +0000</pubDate>
		<dc:creator>Seich</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://seich.martianwabbit.com/?p=126</guid>
		<description><![CDATA[
Yes people it is true. I am not joking or anything. I wouldn&#8217;t joke with something like this&#8230; The new firefox is out and it is the  best firefox yet. Go check it out:http://www.mozilla.com/en-US/firefox/firefox.html
I am already loving it  
I would recommend checking this video out, as it gives you an insight of what&#8217;s new with [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://seich.martianwabbit.com/wp-content/uploads/2009/07/167662-firefox-35_original.jpg"><img class="size-full wp-image-132 alignleft" title="167662-firefox-35_original" src="http://seich.martianwabbit.com/wp-content/uploads/2009/07/167662-firefox-35_original.jpg" alt="167662-firefox-35_original" width="180" height="211" /></a></p>
<p>Yes people it is true. I am not joking or anything. I wouldn&#8217;t joke with something like this&#8230; The new firefox is out and it is the  best firefox yet. Go check it out:<a href="http://www.mozilla.com/en-US/firefox/firefox.html">http://www.mozilla.com/en-US/firefox/firefox.html</a></p>
<p>I am already loving it <img src='http://seich.martianwabbit.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I would recommend checking this <a href="http://www.mozilla.com/en-US/firefox/video/" target="_blank">video</a> out, as it gives you an insight of what&#8217;s new with this firefox build.</p>
]]></content:encoded>
			<wfw:commentRss>http://seich.martianwabbit.com/firefox-35-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adobe Air</title>
		<link>http://seich.martianwabbit.com/adobe-air/</link>
		<comments>http://seich.martianwabbit.com/adobe-air/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 21:00:13 +0000</pubDate>
		<dc:creator>Seich</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://seich.martianwabbit.com/?p=118</guid>
		<description><![CDATA[Lately, I&#8217;ve been extremely bored. I&#8217;ve been searching for some sort of project related to programming but, I&#8217;ve been unable to get any idea I feel like working on. Yesterday, something changed though, now I have a very minimal idea. I will be using Adobe Air as my platform and try to develop some app I still [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://seich.martianwabbit.com/wp-content/uploads/2009/06/air_20080225162906.jpg"><img class="alignleft size-full wp-image-119" title="Adobe Air" src="http://seich.martianwabbit.com/wp-content/uploads/2009/06/air_20080225162906.jpg" alt="Adobe Air" width="100" height="100" /></a>Lately, I&#8217;ve been extremely bored. I&#8217;ve been searching for some sort of project related to programming but, I&#8217;ve been unable to get any idea I feel like working on. Yesterday, something changed though, now I have a very minimal idea. I will be using Adobe Air as my platform and try to develop some app I still have to think of. Basically, I&#8217;ve only discovered what I want to use as a Platform, I am still in the search for the real app idea though.  I was thinking on making some sort of notepad, or maybe something to check my Facebook friend&#8217;s status and update mine but, I am not sure yet. I might just make a little program to tweet. If anyone has any idea feel free to comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://seich.martianwabbit.com/adobe-air/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple factorial function</title>
		<link>http://seich.martianwabbit.com/simple-factorial-function/</link>
		<comments>http://seich.martianwabbit.com/simple-factorial-function/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 05:42:31 +0000</pubDate>
		<dc:creator>Seich</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[factorial]]></category>
		<category><![CDATA[function]]></category>

		<guid isPermaLink="false">http://seich.martianwabbit.com/?p=111</guid>
		<description><![CDATA[Well, today my sister was working doing her homework and, she kind of got stressed with it, so she called me and, I ended up making it for her&#8230; I learned what a factorial is and, made this nice little function that finds the factorial of any number you pass to it. It was supposed [...]]]></description>
			<content:encoded><![CDATA[<p>Well, today my sister was working doing her homework and, she kind of got stressed with it, so she called me and, I ended up making it for her&#8230; I learned what a factorial is and, made this nice little function that finds the factorial of any number you pass to it. It was supposed to be written in labview, but I don&#8217;t really know what that is&#8230; so I used php xD It worked like a charm in labview according to my sister. so you can also use it in labview I guess :O</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #000000; font-weight: bold;">function</span> factorial<span style="color: #009900;">&#40;</span><span style="color: #000088;">$input</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$input</span><span style="color: #339933;">;</span> <span style="color: #000088;">$x</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$x</span><span style="color: #339933;">--</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$output</span> <span style="color: #339933;">*=</span> <span style="color: #000088;">$x</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$output</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<p>I made an example of this function&#8217;s usage using JavaScript, check it out <a href="http://martianwabbit.com/Scripts/functions/factorial.html">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seich.martianwabbit.com/simple-factorial-function/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Basic of $_GET variables (PHP)</title>
		<link>http://seich.martianwabbit.com/basic-of-_get-variables-php/</link>
		<comments>http://seich.martianwabbit.com/basic-of-_get-variables-php/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 08:30:55 +0000</pubDate>
		<dc:creator>Seich</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://seich.martianwabbit.com/?p=96</guid>
		<description><![CDATA[Hello everyone, today I am posting a tutorial on the basic usage of the $_GET super variable in php. This tutorial was originally posted at the MWPS community forums, which almost never is read so I figured that this would be a better place for it to be. It goes through the basics of the [...]]]></description>
			<content:encoded><![CDATA[<p>Hello everyone, today I am posting a tutorial on the basic usage of the $_GET super variable in php. This tutorial was originally posted at the MWPS community forums, which almost never is read so I figured that this would be a better place for it to be. It goes through the basics of the $_GET variable and some basic usage examples.<br />
<span id="more-96"></span><br />
First, I know most people will ask, especially if you are new with PHP, what’s so special about the $_GET Variable?</p>
<p>Well, there’s something really special about this variable, it allows you to get information directly from the url&#8230;. yeah that’s right there’s a way to get fast user input directly from the url no forms or anything, it doesn&#8217;t necessarily needs to be user input it can also be a script leaving behind some variables for the next script and many other uses you will be able to figure out by yourself after you are done with this tutorial&#8230;. the most know use for is used on most CMS and simple page scripts. Still figuring out how does it work? I am pretty sure you will recognize how it works with this example:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">http://www.martianwabbit.com/page.php?id=home</div></td></tr></tbody></table></div>
<p>In the above example you can see something odd about the url the &#8220;?id=home&#8221; after the file name well that’s exactly where your $_GET variables are gotten from. I guess some of you will just think of the thousands of possibilities this opens and, how you can use it to improve your scripts.<br />
But how do I get the information stored on the &#8220;?id=home&#8221;?<br />
That’s simple first of you need to know that the above its saying that &#8220;id&#8221; equals &#8220;home&#8221; just as a variable $x = y;. Now that you know what it means you should be able to get the information easily.<br />
Well to use that information it is recommended that you assign a variable with it so, you could use it directly but you won’t be able to edit it along the script also this helps making it easier to call and read. This is how it works:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>simple isn&#8217;t it? now you can call the variable using $id and you will see how it gets whatever text it’s on the url.<br />
a simple way to see this in action is making a simple script:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #666666; font-style: italic;">//set $id 's value to whatever is contained on the url.</span><br />
<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #666666; font-style: italic;">//echo the variable's value.</span><br />
<span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$id</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<p>In the above example we set $id with the value that came with url and then we echo &#8216;ed it.<br />
This is the simplified basics behind this variable but you can use this for a multitude of things. Before we go on to the &#8220;multitude of things&#8221; I want to show you how to get multiple values from a single url, yep that’s right you aren&#8217;t limited to 1 variable after the ?, you are limited&#8230;.well you are not limited on the number of values you can get from the url like this.<br />
But how do I get multiple values from the url do I separate them with a comma or what?<br />
well in fact you could separate them with a comma but that’s the less practical way the best way is to add additional values to the url like this:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">http://www.martianwabbit.com/page.php?id=20&amp;page=2</div></td></tr></tbody></table></div>
<p>Noticed how I added an additional variable and value there? yeah I simply added a &#038;(meaning &#8220;and&#8221;) and added an additional Name = Value, please notice that there is no additional ? after the &#038;.<br />
ok now I have two variables to play with but how do I manipulate both of them?<br />
well this simple example can explain it better than what I could:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <br />
<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$page</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'page'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;you are looking for <span style="color: #006699; font-weight: bold;">$id</span>'s page <span style="color: #006699; font-weight: bold;">$page</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<p>see how simple it is? if the file above was named &#8220;page.php&#8221; and I typed in:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">http://www.martianwabbit.com/page.php?id=home&amp;page=2</div></td></tr></tbody></table></div>
<p>In the browser I would get this:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">you are looking for home's page 2</div></td></tr></tbody></table></div>
<p>Easy right? well this is how you add multiple variable names and values through the url.<br />
Now what? What can I do with all this information I just learned? well, I decided to include a little practical example.</p>
<p>Remember that I mentioned that this is commonly used in simple page systems? Well this is how it’s done:<br />
Imagine you want to have a specific page style to be used to display some articles you could make a new HTML page for each article (which would make you waste time and effort on ) or you could use a dynamic page to grab whatever page is requested from the url and simply append the contents to the page style you want to use.<br />
If you voted for the second option this is a way of doing it, it might get a little out of the scope of the tutorial but its only to illustrate a use for it:<br />
First, we need to make sure a value is always set, we going to use the variable $id and $page to specify a page name($id) and a page number($page). to make sure that there’s a variable value always not only when it’s specified on the url (i.e. to display a homepage) we do a simple check !isset (means &#8220;is not set&#8221;) if this is true then a default value is used. this is how it should look like:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #666666; font-style: italic;">//we set a default value in case no page is being looked for.</span><br />
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//in case no file is being looked up.</span><br />
<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Home&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//if theres a value.</span><br />
<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #666666; font-style: italic;">//we set a default value in case no page number is specified.</span><br />
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'page'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$page</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//if theres a value look for it.</span><br />
<span style="color: #000088;">$page</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<p>ok now we are sure the variable is always there next thing we need is the html, our &#8220;template&#8221; so we make a simple html template mine looks like this:</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/title.html"><span style="color: #000000; font-weight: bold;">title</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/title.html"><span style="color: #000000; font-weight: bold;">title</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>That’s enough for it to work. Okay, now it’s time to add some content. so we add a include into the body:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;html&gt;<br />
&lt;title&gt;&lt;/title&gt;<br />
&lt;/html&gt;<br />
&lt;body&gt;<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;pages/<span style="color: #006699; font-weight: bold;">$id</span>-<span style="color: #006699; font-weight: bold;">$page</span>.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> <br />
&lt;/body&gt;</div></td></tr></tbody></table></div>
<p>ok that should work perfectly but let’s add some additional stuff to make it look nicer and more dynamic&#8230; we can add a title dynamically getting it from the page name:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;html&gt;<br />
&lt;title&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$id</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/title&gt;<br />
&lt;/html&gt;<br />
&lt;body&gt;<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;pages/<span style="color: #006699; font-weight: bold;">$id</span>-<span style="color: #006699; font-weight: bold;">$page</span>.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> <br />
&lt;/body&gt;</div></td></tr></tbody></table></div>
<p>ok our tile is dynamically changed but this script is still missing some stuff for it to be practical we will add a file check before including the content and an error in case the file doesn&#8217;t exist:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$id</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #666666; font-style: italic;">//make sure file exists before attempting to open it.</span><br />
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/file_exists"><span style="color: #990000;">file_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;pages/<span style="color: #006699; font-weight: bold;">$id</span>-<span style="color: #006699; font-weight: bold;">$page</span>.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//if it exists open the file.</span><br />
<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;pages/<span style="color: #006699; font-weight: bold;">$id</span>-<span style="color: #006699; font-weight: bold;">$page</span>.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//in case file doesn't exist throw a error.</span><br />
<span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;file not found&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&lt;/body&gt;</div></td></tr></tbody></table></div>
<p>now it’s done you should have this or something quite similar to it:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <br />
<span style="color: #666666; font-style: italic;">//By Seich(http://martianwabbit.com/)</span><br />
<span style="color: #666666; font-style: italic;">//we set a default value in case no page is being looked for.</span><br />
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//in case no file is being looked up.</span><br />
<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Home&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//if theres a value.</span><br />
<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #666666; font-style: italic;">//we set a default value in case no page number is specified.</span><br />
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'page'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$page</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//if theres a value look for it.</span><br />
<span style="color: #000088;">$page</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&lt;html&gt;<br />
&lt;!--html part--&gt;<br />
&lt;head&gt;<br />
&lt;!--set title dynamically depending on what file is being read.--&gt;<br />
&lt;title&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$id</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;!--Change body Dynamically depending on the content--&gt;<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #666666; font-style: italic;">//make sure file exists before attempting to open it.</span><br />
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/file_exists"><span style="color: #990000;">file_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;pages/<span style="color: #006699; font-weight: bold;">$id</span>-<span style="color: #006699; font-weight: bold;">$page</span>.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//if it exists open the file.</span><br />
<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;pages/<span style="color: #006699; font-weight: bold;">$id</span>-<span style="color: #006699; font-weight: bold;">$page</span>.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//in case file does not exist throw a error.</span><br />
<span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;file not found&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&lt;/body&gt;</div></td></tr></tbody></table></div>
<p>now you need to create a folder called &#8220;pages&#8221; in the same directory you have this script , files inside should be ending with a .php and should be named like this &#8220;name-number.php&#8221; starting from number 1 for it to work with no problems. With this you can now call the file using the a url.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">http://martianwabbit.com/page.php?id=name&amp;page=2</div></td></tr></tbody></table></div>
<p>this would open file : name-2.php in the body.<br />
Okay, there you got it we have gone through all the basics behind the $_GET variable and now you know how special it is. You also know how practical it can be and how much time it can save you (as PHP can in general) and we also went through a practical example which can obviously be expanded as much as you want to make&#8230; idk&#8230; a full CMS or anything you can dream of&#8230;<br />
Hope this helped you understand one important part behind PHP. if by any reason you don&#8217;t understand something or have a question or simply love it just leave a comment here.</p>
]]></content:encoded>
			<wfw:commentRss>http://seich.martianwabbit.com/basic-of-_get-variables-php/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
