Services_Eventful PHP Package

Installation

If you have the ability to install PEAR packages (type pear help to verify), installation should be as simple as:

pear install http://api.eventful.com/libs/php/Services_Eventful.latest.tgz

If PEAR isn't available, follow these steps to install the package:

  1. Download the latest release of Services_Eventful.
  2. Unzip the archive into a temporary directory: tar -xzvf Services_Eventful.latest.tgz
  3. Copy the Eventful.php file from the temporary directory into a Services directory under your PHP library path.
  4. Copy the get_event.php example script from the temporary directory into a directory along with your other PHP scripts.

Description

The Eventful API allows you to build tools and applications that interact with Eventful. This package provides a PHP interface to that API, including the digest-based authentication infrastructure.

See the API documentation at http://api.eventful.com for details.

Synopsis

require 'Services/Eventful.php';

// Enter your application key here. (See http://api.eventful.com/keys/)
$app_key = 'change-this-application-key';

$ev = new Services_Eventful($app_key);

// Authentication is required for some API methods.
$user     = $_REQUEST['user'];
$password = $_REQUEST['password'];

if ($user and $password)
{
  $l = $ev->login($user, $password);
  
  if ( PEAR::isError($l) )
  {
      print("Can't log in: " . $l->getMessage() . "\n");
  }
}

// All method calls other than login() go through call().
$args = array(
  'id' => $_REQUEST['id'],
);
$event = $ev->call('events/get', $args);

if ( PEAR::isError($event) )
{
    print("An error occurred: " . $event->getMessage() . "\n");
    print_r( $ev );
}

// The return value from a call is a SimpleXMLElement object.
print_r( $event );

Methods

Services_Eventful()

Creates a new Services_Eventful object. Requires a valid app_key as provided by Eventful.

login()

Authenticates the given user and retrieves an authentication key from the Eventful API server. The authentication key is automatically passed to the server with each subsequent call().

call()

Calls the specified method with the given arguments and any previous authentication information (including app_key). Returns a SimpleXMLElement object.