Skip to content

Methods Client Library

brianhaveri edited this page Sep 14, 2010 · 8 revisions

List of client library methods and parameters

Method Description Parameter Returns
set_result_type Set return type to ‘array’, ‘object’, or ‘raw’ (raw JSON or XML, whichever server responds with) string $type [none]
last_request Get the last request sent to the API [none] string

Sample Code

set_result_type()

require_once('ColourLovers.php');
$c = new ColourLovers;
$c->set_result_type('raw');
$result = $c->color('00FF00');
echo $result; // echoes XML

last_request()

require_once('ColourLovers.php');
$c = new ColourLovers;
$results = $c->colors(array(
	'keywords'	=> 'sky+cloud',
	'orderCol'	=> 'numVotes',
	'sortBy'	=> 'ASC'
));
// http://www.colourlovers.com/api/colors?keywords=sky%2Bcloud&orderCol=numVotes&sortBy=ASC
echo $c->last_request();
Clone this wiki locally