// retrieves the image array of stdObjects
$images = $body->SearchForImagesResult->Images;
// endpoint url for GetImageDetails
$imagedetails_endpoint = "http://connect.gettyimages.com/v1/search/GetImageDetails";
// iterate through the array of image stdObjects
foreach ($images as $image) {
    // get the image ID
    $imageId = $image->ImageId;
    // build array to query api for images
    $imageDetailsArray = array("RequestHeader" => array("Token" => $token), "GetImageDetailsRequestBody" => array("CountryCode" => "USA", "ImageIds" => array($imageId)));
    // encode
    $json = json_encode($imageDetailsArray);
    // dispatch search, get body of response
    $imageDetailsBody = dispatchRequest($imagedetails_endpoint, $json);
    // dump contents of image details to the console for sake of example
    print_r($imageDetailsBody);
}
// ALTERNATIVELY, IF THERE IS MORE THAN 1 IMAGE
$imageIdArray = array();
foreach ($images as $image) {
    // get the image ID
    $imageIdArray[] = $image->ImageId;
}
// build array to query api for images
$imageDetailsArray = array("RequestHeader" => array("Token" => $token), "GetImageDetailsRequestBody" => array("CountryCode" => "USA", "ImageIds" => $imageIdArray));
// encode
$json = json_encode($imageDetailsArray);
// dispatch search, get body of response
$imageDetailsBody = dispatchRequest($imagedetails_endpoint, $json);
// dump contents of image details to the console for sake of example
print_r($imageDetailsBody);
    $body = json_decode($response->getBody());
    // returns stdObject
}
// get image array from the stdObject
$images = $body->SearchForImagesResult->Images;
// for each image (in this case, 1), pull the image details from the api and get the size key to send for authorizations
foreach ($images as $image) {
    $imageId = $image->ImageId;
    // build call for this image's details, where sizeKey resides
    $endpoint_imagedetails = "http://connect.gettyimages.com/v1/search/GetImageDetails";
    // build array to query api for images
    $imageDetailsArray = array("RequestHeader" => array("Token" => $token), "GetImageDetailsRequestBody" => array("CountryCode" => "USA", "ImageIds" => is_array($imageId) ? $imageId : array($imageId)));
    // encode
    $json_imagedetails = json_encode($imageDetailsArray);
    // dispatch search, get body of response
    $imageDetailsBody = dispatchRequest($endpoint_imagedetails, $json_imagedetails);
    // get size key from the image details stdObject
    $imageDetails = $imageDetailsBody->GetImageDetailsResult->Images[0];
    $imageSizeKey = $imageDetails->SizesDownloadableImages[0]->SizeKey;
    // build request to download authorizations
    $endpoint_download_auth = "http://connect.gettyimages.com/v1/download/GetImageDownloadAuthorizations";
    // build array to query api for images
    $imageAuthorizationArray = array("RequestHeader" => array("Token" => $token), "GetImageDownloadAuthorizationsRequestBody" => array("ImageSizes" => array(array("ImageId" => $imageId, "SizeKey" => $imageSizeKey))));
    // encode
    $json_download_auth = json_encode($imageAuthorizationArray);
    $httpClient = new Zend_Http_Client($endpoint_download_auth);
    $httpClient->setRawData($json_download_auth, 'application/json');
    $httpClient->setMethod(Zend_Http_Client::POST);
    // all getty api requests are POST
    // Zend_Http_Response
    $response = $httpClient->request();