Make a fully operational REST API in PHP

Routing a JSON REST request
Converting it into SQL
Executing it
Giving a meaningful response

Save this file as “api.php” in your (Apache) document root and call it using:
Or you can use the PHP built-in webserver from the command line using:
The URL when ran in from the command line is:
NB: Don’t forget Read More →

1. Human Readable Random String
This code will create a human readable string that will look more close to dictionary words, useful for captchas.

*@length - length of random string (must be a multiple of 2)
function readable_random_string($length = 6){
srand ((double)microtime()*1000000);
$max = $length/2;
for($i=1; $i<=$max; $i++)
return $password;

2. Generate a Random String
If you don’t need human readable string, then use Read More →

There is a list at the official PHP website: You can see that PHP can work with OAuth, SCA, SOAP, Yar and XML-RPC. But there is another way which is so simple to create a webservice. It is JSON.
How to create a simple web service with JSON
I will show how to create a simple Read More →

UPDATE: I updated this article with some information about password cracking with the reason to use the algorithms bcrypt or scrypt to store the user’s password instead of hash + salt mechanisms. Moreover, I proposed a new RNG based on the usage of /dev/urandom if OpenSSL is not available.
If you are a professional web developer, Read More →