CakePHP RESTFul Routes – Basics


In my opinion, CakePHP is a well equipped framework for building web applications. In this article I will try to explain how I overcame certain obstacles challenges when dealing with CakePHP and RESTFul Routes. For this article I used CakePHP v2.4.3 with a slight alteration to the core code => will be fixed in 2.4.4.

Lees verder CakePHP RESTFul Routes – Basics

Parsing HTML in a nutshell

Ever wanted to get data from a particular webpage / service but they don’t have an API available for the public? You really want to use the data for whatever reason floats your boat? If so, what you will be wanting to do is crawl the webpage and gather all the data you need.

For this tutorial we’re going to parse HTML data via the Simple HTML DOM Parser PHP script. What it does is fetch all the contents of a webpage and makes it searchable with CSS like selectors. You can find the source for this gem right here at All we need is the simple_html_dom.php script, everything else is example data.

We’ll work with the following scenario: I want to fetch all the articles from, in my case, the homepage of NetTuts+ so I can email them to myself every morning (via a cronjob). When I open my email I want to see the title of the post, the permalink to the post and the thumbnail that goes with each post. I will not cover the email part in this tutorial because it falls out of scope.

Lees verder Parsing HTML in a nutshell

CakePHP 2.0 – Storing Sessions in the database and retrieving online users


An updated version of this article is available here: CakePHP 2.8.x: Storing Sessions in the Database Revisited


Because I want to make this example as easy to understand for everyone, I will write it in English. I’m not a native speaker / writer so there might be some grammar errors for which I apologize in advance.


What I will be covering today is how to configure your CakePHP 2.0 system to use your database to store user sessions, if you have one obviously. This could be useful to manage multiple sessions from different devices / ip addresses and to make sure no one else is signed in when you sign in somewhere else. Those parts I won’t be covering today, because that wouldn’t make this a small-tutorial =]. What I will be covering is something I find to be extremely handy in some situations, and that’s a method that shows you who’s online by checking recent session data.

Lees verder CakePHP 2.0 – Storing Sessions in the database and retrieving online users