Skip to content

Instantly share code, notes, and snippets.

@molcik
Last active October 6, 2018 02:53
Show Gist options
  • Save molcik/741f9c2afb7dd97aaaa130d334dc29f6 to your computer and use it in GitHub Desktop.
Save molcik/741f9c2afb7dd97aaaa130d334dc29f6 to your computer and use it in GitHub Desktop.
Getty Images API SDK - PHP
<?php
require __DIR__.'/vendor/autoload.php'; // <--- Notice this line, it's missing in example file
// include __DIR__.'/build/GettyImagesApi.phar'; // <--- Uncaught DI\Definition\Exception\DefinitionException: Entry "ICurler" cannot be resolved
include __DIR__.'/src/GettyImages_Client.php';
use GettyImages\Api\GettyImages_Client;
$apiKey = "superSecretApiKey";
$apiSecret = "superSecretApiSecret";
//Example of built in search images endpoint
$types = array("easyaccess", "editorialsubscription");
$client = GettyImages_Client::getClientWithClientCredentials("$apiKey", "$apiSecret");
$response = $client->SearchImages()->withPhrase("cat")->withProductTypes($types)->execute();
var_dump($response);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment