Facebook Page JSON & RSS Feed
Ever wanted to put a Facebook page’s feed into your website? Every Facebook page has an RSS & JSON feed. In this tutorial I will show you how to use PHP and JSON to pull the feed from Facebook...
View ArticleIntroduction to PHP PDO
CONNECTION //replace host, database, user, password $dbh = new PDO("mysql:host=mysql.host.com;dbname=DATABASE", 'USER', 'PASSWORD'); SELECT $stmt = $dbh->prepare("SELECT id, name FROM table");...
View ArticleSwapping variables in PHP
I’ve created a short and sweet PHP function swap() to exchange/swap the values of two PHP variables. Here it is in action: <?php $cat = "cat"; $dog = "dog"; swap($cat,$dog); echo "$cat goes meow and...
View Articletimthumb and PHP thumbnails rotate with large images
I’ve been banging my head against the wall trying to figure out why large images were getting rotated when I made them into a thumbnail (either through timthumb or PHP’s imagejpeg). It turns out that...
View ArticleRecursion in PHP
Using recursion can be a little hard to grasp if you are new to the concept. In it’s simplest form it’s a function that calls upon itself to create a loop. It is commonly used for traversing tree...
View ArticleTexting with PHP
Ever needed to text someone through PHP? It’s very simple! Most cellular providers give an email address with your phone number that can be used to text that number. This is known as “email to SMS...
View ArticleRemove .php extensions with .htaccess
You can clean up your URL a little by automatically removing the .php extensions and index files using mod_rewrite. This requires your web server has Apache running the mod_rewrite module. Create an...
View ArticleResizing High Resolution (Hi-res) JPEG Images with PHP
I kept running into a problem when I uploaded high resolution (14MP) images and tried creating thumbnails with them. The issue turned out being the PHP script ran out of memory. So it was a simple...
View ArticleCombining Javascript Files to Reduce HTTP Requests
I just wanted a very basic PHP script to combine all my JS files into one – no minification, just bring them together into one file. <?php // compress the file using GZIP ob_start("ob_gzhandler");...
View ArticlePHP namespaces and __autoload() for dummies (like me)
Using autoload and namespaces in PHP is for object-oriented programming. Autoload When building your classes and including them on pages that will use them, it can become tedious to have to write...
View Article