예제 #1
0
 /**
  * @param string $fileUrl
  * @param string $localFilePath
  * @return bool|void
  */
 protected function retrieveRemoteImage($fileUrl, $localFilePath)
 {
     $this->curl->setConfig(['header' => false]);
     $this->curl->write('GET', $fileUrl);
     $image = $this->curl->read();
     $this->fileUtility->saveFile($localFilePath, $image);
 }
예제 #2
0
 /**
  * Send curl purge request
  * to invalidate cache by tags pattern
  *
  * @param string $tagsPattern
  * @return void
  */
 protected function sendPurgeRequest($tagsPattern)
 {
     $headers = ["X-Magento-Tags-Pattern: {$tagsPattern}"];
     $this->_curlAdapter->setOptions([CURLOPT_CUSTOMREQUEST => 'PURGE']);
     $this->_curlAdapter->write('', $this->_helper->getUrl('*'), '1.1', $headers);
     $this->_curlAdapter->read();
     $this->_curlAdapter->close();
 }
예제 #3
0
 /**
  * @param string $fileUrl
  * @param string $localFilePath
  * @return void
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 protected function retrieveRemoteImage($fileUrl, $localFilePath)
 {
     $this->curl->setConfig(['header' => false]);
     $this->curl->write('GET', $fileUrl);
     $image = $this->curl->read();
     if (empty($image)) {
         throw new \Magento\Framework\Exception\LocalizedException(__('Could not get preview image information. Please check your connection and try again.'));
     }
     $this->fileUtility->saveFile($localFilePath, $image);
 }