Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying custom Curl options in curl_options config parameter #136

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Only call curl_setopt_array if config value exists.
  • Loading branch information
Ryan Hayle committed Jul 9, 2015
commit c41e6903e89607735ae1e4790f5b1816951088f5
4 changes: 3 additions & 1 deletion src/Factories/File.php
Original file line number Diff line number Diff line change
@@ -108,7 +108,9 @@ protected static function createFromUrl($file)
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt_array($ch, Stapler::getConfigInstance()->get('stapler.curl_options'));
if ($curl_options = Stapler::getConfigInstance()->get('stapler.curl_options')) {
curl_setopt_array($ch, $curl_options);
}
if ($rawFile = curl_exec($ch) === false) {
$errMsg = "Unable to download file: $file\n";
throw new FileException($errMsg . curl_error($ch), curl_errno($ch));