Implementing Getty Images API SDK – PHP

I have been implementing Getty Images API SDK and for my infinite luck into wordpress theme. It’s no secrete that PHP is my least favourite language. And of course there were these obscure errors, I love so much, during the implementation. So here is how I get the shit done.


I’m not frequent user of PHP and it was surprise for me when I get to  Getty Images API SDK – PHP and found out, that I have to use some kind of package manager to install it. So went the other way and builded it from source. All you have to do is just download or clone it. And run


If you get error run

php --ini

and locate php.ini file. Open it and set phar.readonly to Off.

phar.readonly = Off

if everything runs smoothly, dependencies are downloaded in to the vendor folder and .phar file is created in build folder.


Now comes the fun part. In my case I have followed the that is in example folder and I get error.

Error #1

Uncaught DI\Definition\Exception\DefinitionException: Entry "ICurler" cannot be resolved

which was cased by using builded .phar instead of source, or some kind of PHP black magic. And now — few hours later after resolving this obscure error, another sweet one:

Error #2

“error":"unauthorized_client","error_description":"The client id provided is not trusted"

Cool, at least connection to endpoint has been made. So I have looked into documentation to find this error code, but nothing about client_id. I have googled it and found nothing useful. So I have wrote to the support and get this answer:

… I’ve included my colleague Diego to the email chain, who takes care of API queries.

Diego has looked at your API key and made some amends and so your issue should be resolved now...

Nice, after 2 days I have made connection to the endpoint. What a beautiful, language, what a beautiful API. Here is my testing script:


Buy me a coffeeOut of coffee 😱, please help!