thesmart/php-topsy

A php rest client for Topsy's Otter API with support for rate limiting and error handling

v0.1.0 2012-08-23 23:10 UTC

This package is not auto-updated.

Last update: 2024-04-27 12:54:04 UTC


README

A php rest client for Topsy's Otter API with support for rate limiting and error handling.

Brought to you by the fine developers @ Telly.com

Usage

Usage is very simple, similar to Facebook's SDK:

$topsy = new TopsyApi('my api key', 'example.com');
try {
	$result = $topsy->api('authorinfo', array('url' => 'http://twitter.com/thesmart'));
} catch (TopsyApiException $tae) {
	error_log('Topsy error message: ' . $tae->getMessage());
	error_log('Topsy status code: ' . $tae->getCode());
}

The contents of $result is this:

array (
	'name' => 'John Smart',
	'nick' => 'thesmart',
	'description' => 'Chief Architect and CoFounder of Zoosk.com. Geeky and profound, enjoying the ride.',
	'influence_level' => 0,
	'url' => 'http://twitter.com/thesmart',
	'image_url' => 'http://a0.twimg.com/profile_images/1508630405/Screen_shot_2011-02-23_at_3.10.25_PM.png_normal.jpg',
	'type' => 'twitter',
	'topsy_author_url' => 'http://topsy.com/twitter/thesmart',
);