<?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>Joseph Tinsley &#187; PHP</title>
	<atom:link href="http://www.josephtinsley.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.josephtinsley.com</link>
	<description>Trying to build applications that I think are useful</description>
	<lastBuildDate>Thu, 11 Aug 2011 03:36:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>My First Mongo PHP APP</title>
		<link>http://www.josephtinsley.com/2011/02/26/my-first-mongo-php-app/</link>
		<comments>http://www.josephtinsley.com/2011/02/26/my-first-mongo-php-app/#comments</comments>
		<pubDate>Sun, 27 Feb 2011 00:08:23 +0000</pubDate>
		<dc:creator>Joseph</dc:creator>
				<category><![CDATA[me]]></category>
		<category><![CDATA[MongDB]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[Sql]]></category>

		<guid isPermaLink="false">http://www.josephtinsley.com/?p=468</guid>
		<description><![CDATA[Today I created my first MongoDB application. Please no applause, this app is incredibly boring.  At the time I was fresh out of cool ideas, especially ideas that required a nice amount of data. So I went with a simple US Population search script. I actually had a copy of the 2009 census data in [...]]]></description>
			<content:encoded><![CDATA[<p>Today I created my first MongoDB application. Please no applause, this app is incredibly boring.  At the time I was fresh out of cool ideas, especially ideas that required a nice amount of data.<br />
So I went with a simple <a href="http://www.josephtinsley.com/seo-tools/my-first-mongo-php-app.php">US Population search script</a>. I actually had a copy of the 2009 census data in a mysql table from some time ago. I have no idea why, I guess I&#8217;m a hoarder like that.<br />
But basically I built this just for the experience. I&#8217;ve been hearing a lot of hub bub about MongoDB and thought I should give it a try.  I have to say from what I&#8217;ve fiddled with so far it is pretty interesting. If you&#8217;re coming from a RDBMS like I was, it&#8217;s going to take some time to change your thought process.</p>
<p>MongoDB store its data in what they call documents which are somewhat like table rows. I&#8217;m not going to go down that road because I&#8217;m still a newbie myself and I don&#8217;t want to put anyone on the wrong path. But what helped me get along was that I envisioned accessing data from a XML feed. Of course MongoDB documents are not XML feeds but they are structured a bit like a feed.</p>
<p>For example goto Buy.com and view the source of one of their product feeds (<a href="http://www.buy.com/rss/feed.asp?loc=273&amp;grp=4">Example Product Feed</a>) look specifically at each product node. When accessing data from MongoDB document I put myself in the mindset as if I&#8217;m grabbing data from a XML product feed.  Crazy, but it works for me.</p>
<p><a href="http://www.josephtinsley.com/images/2011/02/mongodb-documents-e1298764730669.png"><img class="size-medium wp-image-478 alignnone" title="mongodb-documents-mongovue" src="http://www.josephtinsley.com/images/2011/02/mongodb-documents_300x270.png" alt="Mongo Document Mongovue" width="300" height="270" /></a></p>
<p>Bottom line I think MongoDB is pretty interesting, I&#8217;m still new to it so I&#8217;m not quite ready to ditch MySql.<br />
During my quest for knowledge I found myself looking for examples to help me get started. In my opinion there wasn&#8217;t that much out there but that&#8217;s probably because it&#8217;s fairly still new. But here are few sites that help me get started.</p>
<ul>
<li><a href="http://learnmongo.com/">http://learnmongo.com/</a> &#8211; He/She had some good PHP examples.</li>
<li><a href="http://www.php2all.de/manual/mongo.tutorial.html">http://www.php2all.de/manual/mongo.tutorial.html</a> &#8211; Also has some good PHP &amp; MongoDB example</li>
<li><a href="http://www.mongodb.org/">http://www.mongodb.org/</a> &#8211; The MongoDB Official site
<ul>
<li><a href="http://www.mongodb.org/display/DOCS/SQL+to+Mongo+Mapping+Chart">http://www.mongodb.org/display/DOCS/SQL+to+Mongo+Mapping+Chart</a> – The Sql to MongoDB mapping chart is pretty cool.</li>
</ul>
</li>
<li><a href="http://blog.mongovue.com/">http://blog.mongovue.com/</a> &#8211; I think it&#8217;s a great tool for view your collections and documents.</li>
<li><a href="http://www.slideshare.net/kriswallsmith/mongod-pdxphp">http://www.slideshare.net/kriswallsmith/mongod-pdxphp</a>
<ul>
<li>Also check around for other presentations on slideshare.com there a bunch of good one out there.</li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.josephtinsley.com/2011/02/26/my-first-mongo-php-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make Twitter Updates with PHP and cURL</title>
		<link>http://www.josephtinsley.com/2010/06/18/twitter-updates-with-php-and-curl/</link>
		<comments>http://www.josephtinsley.com/2010/06/18/twitter-updates-with-php-and-curl/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 06:13:14 +0000</pubDate>
		<dc:creator>Joseph</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[APIs]]></category>
		<category><![CDATA[PHP Code]]></category>

		<guid isPermaLink="false">http://www.josephtinsley.com/?p=403</guid>
		<description><![CDATA[I&#8217;m sure I&#8217;ve mentioned sometime before that I&#8217;m a big fan of Twitter. I think Twitter has done a great job with their API, and the documentation for their API. They&#8217;ve made it fairly simple for developers to create Twitter based applications without jumping through a lot of hoops. Well below is a bit of [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m sure I&#8217;ve mentioned sometime before that I&#8217;m a big fan of Twitter. I think Twitter has done a great job with their API, and the documentation for their API. They&#8217;ve made it fairly simple for developers to create Twitter based applications without jumping through a lot of hoops.</p>
<p>Well below is a bit of code I&#8217;ve used in the past to make status updates to Twitter. If your familiar with cURL then you&#8217;ll see that its pretty straight forward. The end result examines the HTTP code to determine if the status update was successful or failed you can comment this part out if you wish.</p>
<p>But before you go plowing away with the code I think it would be a good idea if you make yourself familiar with their documentation. They have a few rules that could save you some heartache down the road.</p>
<p>== Twitter Documentation ==<br />
<a href="http://apiwiki.twitter.com/Twitter-API-Documentation">http://apiwiki.twitter.com/Twitter-API-Documentation</a></p>
<p>== PHP Code To Post Twitter Status Updates ==</p>
<div class="codecolorer-container php geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:200px;"><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 /></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 />
<br />
<span style="color: #666666; font-style: italic;">/* Post Twitter Status Update using PHP &amp; cURL */</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> postToTwitter<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: #339933;">,</span><span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; <br />
&nbsp; &nbsp;<span style="color: #000088;">$username</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$username</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$password</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #000088;">$twitterHost</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://twitter.com/statuses/update.xml&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #000088;">$yourStatus</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$message</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #000088;">$curl</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp;<span style="color: #000088;">$curl</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 />
&nbsp; &nbsp;<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;">$curl</span><span style="color: #339933;">,</span> CURLOPT_CONNECTTIMEOUT<span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<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;">$curl</span><span style="color: #339933;">,</span> CURLOPT_HEADER<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<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;">$curl</span><span style="color: #339933;">,</span> CURLOPT_HTTPAUTH<span style="color: #339933;">,</span> CURLAUTH_BASIC<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<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;">$curl</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<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;">$curl</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;">$username</span>:<span style="color: #006699; font-weight: bold;">$password</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<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;">$curl</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 />
&nbsp; &nbsp;<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;">$curl</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><a href="http://www.php.net/stripslashes"><span style="color: #990000;">stripslashes</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/urldecode"><span style="color: #990000;">urldecode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$yourStatus</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<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;">$curl</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #000088;">$twitterHost</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp;<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;">$curl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #000088;">$resultArray</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;">$curl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$resultArray</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'http_code'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">200</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp;<span style="color: #000088;">$twitterPostStatus</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Success&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp;<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp;<span style="color: #000088;">$twitterPostStatus</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Failed&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp;<span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp;<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;">$curl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<br />
&nbsp;<span style="color: #b1b100;">return</span> <span style="color: #000088;">$twitterPostStatus</span><span style="color: #339933;">;</span> &nbsp; <br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000088;">$username</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'username_here'</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'password_here'</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Working with the Twitter API&quot;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> postToTwitter<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: #339933;">,</span><span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<a href="http://www.php.net/print_r"><span style="color: #990000;">print_r</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><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://www.josephtinsley.com/2010/06/18/twitter-updates-with-php-and-curl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixed Broken Links</title>
		<link>http://www.josephtinsley.com/2010/06/12/fixed-broken-links/</link>
		<comments>http://www.josephtinsley.com/2010/06/12/fixed-broken-links/#comments</comments>
		<pubDate>Sat, 12 Jun 2010 06:22:43 +0000</pubDate>
		<dc:creator>Joseph</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[PHP Code]]></category>
		<category><![CDATA[PHP Tools]]></category>
		<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://www.josephtinsley.com/?p=389</guid>
		<description><![CDATA[I just noticed I had some broken links on my PHP Scripts page. I repaired the links so the downloads should be back to normal. I have to say I looked over the code that was used to make this scripts and a lot of it is old. I&#8217;m leaving it in place hoping that [...]]]></description>
			<content:encoded><![CDATA[<p>I just noticed I had some broken links on my PHP Scripts page. I repaired the links so the downloads should be back to normal.<br />
I have to say I looked over the code that was used to make this scripts and a lot of it is old. I&#8217;m leaving it in place hoping that it can still in some way be helpful.<br />
Later,<br />
Joe</p>
<p>- &#8211; UPDATED &#8211;<br />
I included two scripts that I had on the old site that somehow was forgotten when I made the move.</p>
<ul>
<li><a title="Reverse IP Lookup" href="http://www.josephtinsley.com/seo-tools/reverse-ip-lookup.php">Reverse IP Lookup</a></li>
<li><a title="Sitemap Ping Service" href="http://www.josephtinsley.com/seo-tools/sitemap-ping-service.php">Sitemap Ping Service</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.josephtinsley.com/2010/06/12/fixed-broken-links/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Geolocation by IP Address with PHP</title>
		<link>http://www.josephtinsley.com/2010/01/05/geolocation-by-ip-address-with-php/</link>
		<comments>http://www.josephtinsley.com/2010/01/05/geolocation-by-ip-address-with-php/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 05:00:00 +0000</pubDate>
		<dc:creator>Joseph</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Resource]]></category>
		<category><![CDATA[APIs]]></category>
		<category><![CDATA[Geolocation]]></category>

		<guid isPermaLink="false">http://www.josephtinsley.com/52/2010-01-05/geolocation-by-ip-address-with-php/</guid>
		<description><![CDATA[Something kind of interesting happened today. I was going through my log files and noticed a query for &#8220;joe Tinsley woodland park&#8221; the query originated from &#8220;Medford, Massachusetts&#8221;. Woodland Park was an elementary school located on an air force base in South Carolina that I attended when I was a kid. I take it that [...]]]></description>
			<content:encoded><![CDATA[<p>Something kind of interesting happened today. I was going through my log files and noticed a query for &#8220;joe Tinsley woodland park&#8221; the query originated from &#8220;Medford, Massachusetts&#8221;. Woodland Park was an elementary school located on an air force base in South Carolina that I attended when I was a kid. I take it that someone from my past is trying to locate me. That&#8217;s pretty cool. The crazy part is I just noticed that I don&rsquo;t have anyway for anyone to contact me via my website&#8230; Ha! I make the craziest moves sometimes.<br />Well I&#8217;ve mentioned all of this to say If you&#8217;re looking for a way to pull Geolocation Data from a single IP address try <strong><a title="Geolocation API PHP" href="http://www.ippages.com/lookups/?affid=28656240">IPpages.com&#8217;s</a></strong> APIs. I&#8217;ve been using them for some time now and the service is pretty good. It does require some programming knowledge to the extract the data from the XML results. <br />Please let me know if I can help with any programming questions <em>(PHP only!)</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.josephtinsley.com/2010/01/05/geolocation-by-ip-address-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

