PHP Multi-thread Asynchronous Process Manager

PHP Multi-thread Asynchronous Process Manager

I have been build some background apps recently which need to do a lot of repetitions (think 100,000 times the same task which takes about 0.25 to 1 second to execute, of which most of it is waiting for the remote server to respond). Since these are daily and are not that server intensive it made sense to run them concurrently so instead of taking the good part of the day it just takes a few hours. I noticed on the proc_open page there was a very nice solution by Matou Havlena of

Continue reading “PHP Multi-thread Asynchronous Process Manager”

Password Hashing – With some smart salt

Password Hashing – With some smart salt

Basic hashing of passwords is poor. LinkedIn should have expected that one day that their password list would be stolen and when that happened it should have been hashed better so a standard dictionary could not reverse the passwords. Tthe LinkedIn passwords were leaked all over internet and with the help of crowd-sourced hackers the passwords were easily reversed back from SHA-1 hashes substrings to the plain text passwords. With tools like John the Ripper social hackers like Francois Pesce was able to reverse over 2 million LinkedIn passwords.

Continue reading “Password Hashing – With some smart salt”

Building a URL Shortener from Scratch Using CodeIgniter


Todays post is a little longer and a lot more in-depth. Today we will look at setting up a URL shortening service with CodeIgniter similar to etc. Yes there is 100s already out there, this is just to see how easy it is in CodeIgniter. You can create this service in minutes without breaking a sweat.

Continue reading “Building a URL Shortener from Scratch Using CodeIgniter”

Getting the directory listing using PHP's Glob Function

The other day the new developer  in my office wanted to get a directory listing using  PHP as he was writting a new plugin for WordPress. To his surprise this is really easy with the glob() function:

foreach (glob("*") as $filename) {
    echo $filename . 'size ' . filesize($filename) . 'n';


Glob allows you to use patterns similar to those when you are using the ls command in Terminal and returns the file list as an array.

Get the HTML of any page with PHP

Quick tip: if you want to get the HTML for any web page you can use the PHP function file_get_contents(). To see the HTML in your web browser wrap the htmlentities  function around the file_get_contents() function.


echo htmlentities(file_get_contents(''));

Which returns:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
	<title>IANA &mdash; Example domains</title>
	<!-- start common-head -->
	<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="/_css/2008.1/reset-fonts-grids.css" />
	<link rel="stylesheet" type="text/css" media="screen" href="/_css/2008.1/screen.css" />
	<link rel="stylesheet" type="text/css" media="print" href="/_css/2008.1/print.css" />
	<link rel="shortcut icon" type="image/ico" href="/favicon.ico" />
	<script type="text/javascript" src="/_js/prototype.js"></script>
	<script type="text/javascript" src="/_js/corners.js"></script>
	<script type="text/javascript" src="/_js/common.js"></script>
	<!-- end common-head -->

	<!-- start common-bodyhead -->
	<!-- end common-bodytail -->