ImageCollect Services
Authentication
Pictures
Events
Celebrities
Sales
Sample Code (PHP)
function getSignature($url, $secret, $expires = '1238598470') {
$str = "GET\n\n\n{$expires}\n".$url;
return urlencode(base64_encode(hash_hmac('sha1', $str, $secret, true)));
}
function getApiURL($url, $parameters){
// request will expire in 2 days
$expires = strtotime("+2 days");
$accessKeyId = "GAHYUETIETUYAHXAE";
$secretAccessKey = "EIYAEHOHIEY=CAHHEXIG+EPAESHAHTOXOHCH";
$apiHost = "api.imagecollect.com";
$signature = getSignature($url, $secretAccessKey, $expires);
return "http://{$apiHost}{$url}?{$parameters}&AccessKeyId={$accessKeyId}&Signature={$signature}&Expires={$expires}";
}
////////////////////// Image Details ///////////////////////////////
echo(getApiURL("/images/info.xml", "fileID=5148")." \r\n\r\n");
///////////////////// Image Search Example /////////////////////////////////
$query = urlencode("Carlos");
echo(getApiURL("/images/search.xml", "Q={$query}")." \r\n\r\n");
////////////////////// Event Details ///////////////////////////////
echo(getApiURL("/events/info.xml", "eventID=0000072")." \r\n\r\n");
///////////////////// Event Search Example /////////////////////////////////
$query = urlencode("Australia");
echo(getApiURL("/events/search.xml", "Q={$query}")." \r\n\r\n");
////////////////////// Celebrity Photo Archive ///////////////////////////////
echo(getApiURL("/events/search.xml", '')." \r\n\r\n");
echo(getApiURL("/events/search.xml", 'year=2011')." \r\n\r\n");
echo(getApiURL("/events/search.xml", 'year=2011&month=1')." \r\n\r\n");
////////////////////// Celebrities Listing ///////////////////////////////
echo(getApiURL("/celebrities/index.xml", '')." \r\n\r\n");
echo(getApiURL("/celebrities/index.xml", 'firstLetter=A')." \r\n\r\n");
echo(getApiURL("/celebrities/index.xml", 'firstLetter=B')." \r\n\r\n");