thesmart/php-topsy

一个用于Topsy Otter API的PHP REST客户端,支持速率限制和错误处理

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

This package is not auto-updated.

Last update: 2024-09-28 14:51:59 UTC


README

一个用于Topsy Otter API的PHP REST客户端,支持速率限制和错误处理。

由Telly.com的优秀开发者提供Telly.com

用法

用法非常简单,类似于Facebook的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());
}

$result的内容如下

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',
);