Consuming messagepub’s API with PHP

In this blog post, we are going to demonstrate how to use PHP to consume messagepub’s REST API.

We are going to use phpactiveresource, a PHP client library developed by John Luxford for easily accessing REST services. The library is a PHP port of ActiveResource.

For updated information on how to use phpactiveresource, visit the wiki. There is even a wiki page to show you how to use it with messagepub.

To use the library, download the ‘ActiveResource.php’ file and put it in the same directory as the code you are going to write. The following is an example demonstrating the use of phpactiveresource to create a notification:

Using PHP to consume messagepub's API

Note:Before you can use the library, you need to make sure yo have the curl PHP extensions installed on your system. On Debian/Ubuntu, you can install these with:

sudo apt-get install php5-curl

No comments yet

Leave a reply