in /public_html/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php at line 113
/** * Constructor with three arguments. * @param string $message Message * @param integer $code ErrorCode * @param \Exception $exception full exception * @return StockApi */ public static function withMessageAndErrorCode($message, int $code, \Exception $exception = null) : StockApi { $instance = new static($message, $code, $exception); return $instance; } }
try { $raw_response = $this->_http_client->request('GET', $url, $headers); $http_status_code = $raw_response->getStatusCode(); $raw_headers = $this->getHeadersAsString($raw_response); $response_body = $raw_response->getBody(); } catch (\Exception $e) { throw StockApiException::withMessageAndErrorCode($e->getMessage(), $e->getCode(), $e); } return $response_body; } /**
$previous_offset_value = $search_file_request->getSearchParams()->getOffset(); $find = 'search_parameters%5Boffset%5D=' . $previous_offset_value; $replace = 'search_parameters%5Boffset%5D=' . $offset_value; $request_url = str_replace($find, $replace, $request_url); if ($this->_http_method == 'GET') { $response_json = $this->_http_client->doGet($request_url, $headers); } else { $similar_image_data = APIUtils::downSampleImage($search_file_request->getSimilarImage()); $response_json = $this->_http_client->doMultiPart($request_url, $headers, $similar_image_data); } $response_array = json_decode($response_json, true);
if ($this->_api_in_progress) { throw StockApiException::withMessage('Some other search is already in progress!'); } try { $this->_api_in_progress = true; $response = $this->getFiles($request, $this->_access_token); $this->_doOnSuccess($response); } catch (StockApiException $e) { $this->_doOnError(); throw $e; }
throw StockApiException::withMessage('No more search results available!'); } } $this->_offset = $offset_value; $response = $this->doApiCall($request); return $response; } /** * Method to get to previous search files response page. * @return SearchFilesResponse
/** * Method to get next search files response page. * @return SearchFilesResponse */ public function getNextResponse() : SearchFilesResponse { $response = $this->_search_files_factory->getNextResponse(); return $response; } /** * Method to get to previous search files response page. * @return SearchFilesResponse
$request = new SearchFilesRequest(); $request->setLocale($this->_locale); $request->setSearchParams($search_params); $request->setResultColumns($result_column_array); $response = $adobe_stock_client->searchFilesInitialize($request, '')->getNextResponse(); if (isset($response->error_code)) { \Yii::$app->db->createCommand('INSERT INTO `STAT_error` (`error_code`, `message`) VALUES (:error_code, :message)', [':error_code' => $response->error_code, ':message' => $response->message])->execute(); die; } //echo '<pre>'; print_r($response); echo '</pre>'; die;
return $response; } function media($media_id) { $media = self::search(["media_id" => $media_id]); if (!empty($media->files[0]) AND $media->nb_results == 1) { $data = $media->files[0]; $productMedia = ProductMedia::find()->where(["id_product_media" => $media_id])->one();
$data["calculate_price_photo"] = true; } if (empty($data["media"])) { Yii::$app->adobeStock->media($id); $data["media"] = ProductMedia::findOne($id); $data["type"] = "stock"; $data["calculate_price_photo"] = true; } $data["cart"] = new Cart;
$args = $this->controller->bindActionParams($this, $params); Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
require __DIR__ . '/../../common/config/main.php', require __DIR__ . '/../../common/config/main-local.php', require __DIR__ . '/../config/main.php', require __DIR__ . '/../config/main-local.php' ); (new yii\web\Application($config))->run();
$_GET = [ 'product' => 'obrazy-na-plotnie', 'alias' => 'vitigni-uva-trebbiano-castelvetro-modena-emilia-romagna', 'id' => '65620665', ]; $_SESSION = [ '__flash' => [], 'start' => 1711711262, ];