Get the Original URL behind a Shortened link using PHP

HTTP Request Header of a shortened link

I know a lot of us and our dogs know what shortened links are. If you don't know - they are long URLs which get shortened for convenient link sharing. Example of link-shortening service includes bit.ly, su.pr, tiny.cc, goo.gl etc.In this article, I'm going to show us how to programmatically retrieve the original long URL that got shortened via PHP. Let's examine the headers sent by the server in response to the HTTP request sent by … [Continue reading]

WordPress Meta Box the OOP Way

WordPresss Meta Box

WordPress has a reputation for being bloated, filled with spaghetti codes and not developer friendly because it is a pain in the ass to extend. The reason for the WordPress hate is partly because it is procedurally written which result in an ugly codebase thus making developers cringe.In recent time, WordPress is gradually adopting the Object-oriented programming paradigm albeit at a slow pace.If you have created WordPress Meta Boxes in … [Continue reading]

How to Integrate postgreSQL Database to XAMPP in Windows

postgreSQL Database

Over the weekend, I decided to learn postgreSQL Database. For me to be able to achieve it, I need to as a matter of fact install and get it running on my local machine. Since I'm using XAMPP already as my LAMP stack, it will be easier to just integrate postgreSQL into it rather than compiling it with PHP from scratch.In this article, I will show us how I was able to install and integrate postgreSQL to XAMPP as well as pgAdmin and phpPgadmin … [Continue reading]

Top 5 Free Outlook Viewers

Outlook PST Viewer

MS Outlook keeps emails on user's hard drive in PST files. This format contains email information coded in such a way that it can't be read outside of its native mail client. You can view their content only using special PST viewers that will decode your PST email storage and show the texts of messages. There are a few important features that a PST mail viewer should have:Clean user interface Easy navigation through emails Ability to … [Continue reading]

Building Image Scraper using Symfony’s DomCrawler

PHP tutorial

This is an article i wrote for sitepoint.com. Below is an excerpt form and link to the full article. You will definitely love it. A photographer friend of mine implored me to find and download images of picture frames from the internet. I eventually landed on a web page that had a number of them available for free but there was a problem: a link to download all the images together wasn’t present.I didn’t want to go through the stress of … [Continue reading]

PHP – Count the number of files in a Directory / folder

Perform Case-insensitive comparison of strings in PHP

I was working on a PHP project and needed to display an error message when a given folder / directory is empty.Below is a function that count the number of files (and/or folder) in a folder or directory.[php] < ?php function countFolder($dir) { return (count(scandir($dir)) - 2); } [/php]To use the function, pass the directory to be counted as the function's argument.Note: i subtracted "2" from the gross-count to get the … [Continue reading]

Simple PHP Tool for Converting Character to HTML entities

Simple PHP Tool for Converting Character to HTML entities

I have been using MobilePress to mobilize my blog since its inception. I discovered when HTML source codes are included in a blog post, the code is parsed as HTML when the article is viewed on mobile but is ok when viewed on PC. Mind you, I do wrap the code using a syntax highlighter to prevent the code from being parsed.The problem was as a result of the absent of the syntax highlighter component (JavaScript and CSS files) in … [Continue reading]

Capture and Validate Multi-Value Form Data in PHP

Perform Case-insensitive comparison of strings in PHP

I am not going to make this tutorial unnecessarily long so you won't get bored rather I will as much as possible make this article brief and succinct.When writing HTML form, form element such as <checkbox> and <select multiple> are used for capturing multi-value data.Below is an example code for an HTML form consisting of a multi-select and checkbox element.[html] <form method="post" … [Continue reading]