class Shutter
{
const AUTH = 'Authorization: Bearer v2/RTloa0NMRjV4Z2lKOWN4QWZPNUk0NmhEeVM3RXd1WG0vMjg0MzQxMTEzL2N1c3RvbWVyLzMvUUxVdF9SajlXQ3diQ3A5d19VX2F3WGpoalJmY0JnYVlncVZJXzZmTkhKeHY5blVlTGU0b29TdWhJYVdBbHhrbUpHNHdNX09tRTVhYXhxd0d4bWpNaXlUNVluUTN6WVNybWR5TGxfU2h2UGZYTnhqY1o0NVp1X0tGWWhnb3lhb1F2am15Y0xSUmx5dEJsVy1CSndGRmRDTmN4WmR6bDVJelowR05sYmwxYlBuenk1V0g1X3c5VmloM2Z3UTlXdmhQbmVYYUNnOXloVFc4emRZZ2FqRXIwdw';
static function addImageToCollection($imgID, $collectionID = 283344644)
{
$postData = [
'items' => [
['id' => $imgID]
]
];
$auth = self::AUTH;
$options = [
CURLOPT_URL => "https://api.shutterstock.com/v2/images/collections/$collectionID/items",
CURLOPT_USERAGENT => "php/curl",
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_POST => 1,
CURLOPT_HTTPHEADER => ['Content-Type:application/json', $auth],
CURLOPT_POSTFIELDS => json_encode($postData)
];
$handle = curl_init();
curl_setopt_array($handle, $options);
$response = curl_exec($handle);
curl_close($handle);
$decodedResponse = json_decode($response, true);
return $decodedResponse;
}
static function getImage($imgID)
{
$auth = self::AUTH;
$options = [
CURLOPT_URL => "https://www.shutterstock.com/editor/image/api/v1/media/image/$imgID",
CURLOPT_USERAGENT => "php/curl",
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_HTTPHEADER => [
'Content-Type:application/json',
'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36',
'referer: https://www.shutterstock.com/en/editor-next/image?embed=true&version=0.51.0&apiKey=k4m3J9SvPBs4clbaPI6ebOUi',
'if-none-match: W/"24b-o2mfgGhMNFsBzhaIzM7OHQJmHrY"'
]
];
$handle = curl_init();
curl_setopt_array($handle, $options);
$response = curl_exec($handle);
curl_close($handle);
$decodedResponse = json_decode($response, true);
if (isset($decodedResponse['error'])) return false;
return $decodedResponse['preview']['image'];
}
static function search($imgID)
{
$auth = self::AUTH;
$options = [
CURLOPT_URL => "https://www.shutterstock.com/editor/image/api/v1/media/image/$imgID",
CURLOPT_USERAGENT => "php/curl",
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_HTTPHEADER => [
'Content-Type:application/json',
'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36',
'referer: https://www.shutterstock.com/en/editor-next/image?embed=true&version=0.51.0&apiKey=k4m3J9SvPBs4clbaPI6ebOUi',
'if-none-match: W/"24b-o2mfgGhMNFsBzhaIzM7OHQJmHrY"'
]
];
$handle = curl_init();
curl_setopt_array($handle, $options);
$response = curl_exec($handle);
curl_close($handle);
$decodedResponse = json_decode($response, true);
if (isset($decodedResponse['error'])) return false;
return $decodedResponse;
}
}
Warning: mysqli::mysqli(): (HY000/2002): Connection refused in /var/www/vhosts/artwall.kz/httpdocs/system/library/db/mysqli.php on line 7
Warning: DB\MySQLi::__construct(): Couldn't fetch mysqli in /var/www/vhosts/artwall.kz/httpdocs/system/library/db/mysqli.php on line 10
Warning: DB\MySQLi::__construct(): Couldn't fetch mysqli in /var/www/vhosts/artwall.kz/httpdocs/system/library/db/mysqli.php on line 10
Fatal error: Uncaught exception 'Exception' with message 'Error: <br />Error No: ' in /var/www/vhosts/artwall.kz/httpdocs/system/library/db/mysqli.php:10
Stack trace:
#0 /var/www/vhosts/artwall.kz/httpdocs/system/library/db.php(9): DB\MySQLi->__construct('srv-pleskdb43.p...', 'artwa_artwall', '24EzTqSyN2bj', 'artwallk_site', NULL)
#1 /var/www/vhosts/artwall.kz/httpdocs/system/config/catalog.php(27): DB->__construct('mysqli', 'srv-pleskdb43.p...', 'artwa_artwall', '24EzTqSyN2bj', 'artwallk_site')
#2 /var/www/vhosts/artwall.kz/httpdocs/system/storage/modification/system/library/config.php(23): require('/var/www/vhosts...')
#3 /var/www/vhosts/artwall.kz/httpdocs/system/framework.php(8): Config->load('catalog')
#4 /var/www/vhosts/artwall.kz/httpdocs/system/startup.php(105): require_once('/var/www/vhosts...')
#5 /var/www/vhosts/artwall.kz/httpdocs/index.php(23): start('catalog')
#6 {main}
thrown in /var/www/vhosts/artwall.kz/httpdocs/system/library/db/mysqli.php on line 10