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.

Dependentcies

  1. Download and install tmhOAuth from github.
  2. PEAR, HTTP_Request2, you should be able to install these via pear.

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 OAuth 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);


// 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.

setup_Oauth()

Sets up all the Oauth parameters to enable a proper http Authorization Oauth header to be sent with the request. Your consumer key and secret and your Oauth token and secret must be passed in. The authentication key is automatically passed to the server with each subsequent call(). Oauth details can be found here.

call()

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