Mar 112015
 

Factual is a geographical database of places, services, points of interest and landmarks that is made available for free through their Application Programming Interface (API)

This post explains how to use a PHP library to access this database, the characteristics of the service, and the details on the content that can be retrieved from the Factual API.

Continue reading »

 Posted by at 9:57 am
Mar 072015
 

There is a wealth of information about the performance of a website available from Google Webmaster Tools. The GWT frontend gives the possibility to manually export this information as several reports in CSV format.

But, to achieve a full integration with an external metrics and monitoring system (for instance, to be able to generate alerts when some conditions are met), a procedure to perform automatically the download of this information is required.

This post reviews a free and open source utility named GWTData that implements this functionality.

Continue reading »

 Posted by at 8:53 am
Dec 032014
 

A web site that delivers any type of service, might need to implement some kind of user signup / login functionality. In this way, registered users could be granted access to extra functionalities not available to anonymous users.

In a previous post we have already covered a possible implementation of this signup / login functionality on a generic web server, using a set of PHP scripts. This post focuses on the specific case of a standalone WordPress installation.

Continue reading »

 Posted by at 3:37 pm
Nov 162014
 

A web site that is going to offer a customized service for registered users need to implement a signup and login procedure. Validated users can then be granted access to functionalities that could eventually make use of specific user data, not available for anonymous users.

This post explains a possible implementation of this signup and login procedure in PHP

Continue reading »

 Posted by at 4:54 pm
Nov 132014
 

If there is enough main memory available in the server where an application is running, a memory cache can significantly improve the performance of the application.

This post is a tutorial on how to install a “memcached” service on a server running linux Debian, and how to use the service in a PHP script.

Continue reading »

 Posted by at 4:52 pm
Nov 042014
 

The default PHP interpreter in most Linux distros includes de Database Abstraction Layer (DBA) extension. DBA implements the functionality required to work with dbm type databases, such as BerkeleyDB. This extension does not  implement all the functionality available in libraries specific for each of the databases types, but it may be enough for most use cases.

This post explains how to use DBA in a PHP script, to carry out the most common operations on a BDB database .

Continue reading »

 Posted by at 6:43 pm
Nov 032014
 

XML is a format commonly used for the interchange of data between software applications.

The easiest way to process data in XML format is by means of some procedure that reads the whole document into a data structure native to the programming language used. In PHP, the result would be an associative array of pairs (key,value). Each of the values in the array, in turn, would be an associative array,  or a primitive value of numeric or string type.

But sometimes, the file holding the XML document may be up to several GBytes in size, and the volume of data to be processed is too big to hold the entire document in memory. In those cases, the file must be processed as a stream: Elements in the file need to be read an processed one element at a time.

This post explains how to work in PHP with large XML documents, by reading them as streams.

Continue reading »

 Posted by at 9:05 am
Sep 042014
 

While a PHP script is executing, a given variable can be assigned values of different data types: simple types (integer, boolean, string,…) as well as complex types (array). At some point during its execution, a script might need to check the type of data stored in a variable.

Arrays are a special case. An array may be created as a sequence of values (that may be simple or complex), or else as a set of (key,value) pairs, where the key is a string, and the value is any data of simple or complex data type.

This post explains how to check in PHP the data type of the value assigned to a variable, specially in the case of arrays.

Continue reading »

 Posted by at 7:47 am