创建应用程序,获取两个密匙。
https://www.shutterstock.com/account/developers/apps
安装:
composer require shutterstock/api
public function tests(){
require_once ROOT_PATH . '/vendor/autoload.php';
$client = new \Shutterstock\Api\Client('rAM5LPelwV9XuxS3GDKK0py8L3O6m55W', 'VAvU5Zm6AK3GAGdR');
// perform an image search for puppies
$imageResponse =$client->get('images/search', array('query' => 'puppies'));
// retrieve details for a handful of image ids
// $imageResponse = $client->get('images', array('id' => array(1, 2, 3)));
// create a lightbox
// $client->post('images/collections', array('name' => 'Lightbox Name Here'));
// $imageResponse = $client->get('images', array('id' => array(1, 2, 3)));
if ($imageResponse->getStatusCode() != 200) {
// error handler
}
$images = $imageResponse->getBody()->jsonSerialize()['data'];
dd($images);
// etc
}