Open webbird opened 7 years ago
This works for me:
public function load(FilterInterface $additionalFilter = null)
{
if(function_exists('curl_init')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, VarUtils::resolve($this->sourceUrl, $this->getVars(), $this->getValues()));
curl_setopt($ch, CURLOPT_REFERER, VarUtils::resolve($this->sourceUrl, $this->getVars(), $this->getValues()));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_PROXY, '<proxy>');
curl_setopt($ch, CURLOPT_PROXYPORT, '<port>');
$content = curl_exec($ch);
curl_close($ch);
} else {
$content = @file_get_contents(
VarUtils::resolve($this->sourceUrl, $this->getVars(), $this->getValues())
);
}
if (false === $content && !$this->ignoreErrors) {
throw new \RuntimeException(sprintf('Unable to load asset from URL "%s"', $this->sourceUrl));
}
$this->doLoad($content, $additionalFilter);
}
As I am behind a proxy, I'd like to add appropriate options. Where should they be placed? AssetFactory.php? Function setProxy()?
I've encountered an issue when using Bootstrap 4 and Bootswatch Themes. Some themes do an @import loading Google fonts.
Warning: file_get_contents(https://fonts.googleapis.com/css?family=Lato:400,700,400italic): failed to open stream: Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte. in\vendor\kriswallsmith\assetic\src\Assetic\Asset\HttpAsset.php on line 57
XDebug Call Stack:
I am going to change / extend the code to use curl instead... has anyone already done it?