Skip to content

Allow for passing curl options #14

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

Merged
merged 5 commits into from
May 28, 2021

Conversation

RomainGoncalves
Copy link

This PR aims to allow the user to pass along to the read method some curl options.

Scenario
If you want to read a feed from a platform/website that requires authentication, you can't at the moment.
By passing curl options manually to the read method, the user can add any tools that they would require per call.

@vedmant
Copy link
Owner

vedmant commented May 27, 2021

@RomainGoncalves Nice, few things: in docs instead of $f = FeedReader::read('https://news.google.com/news/rss', null, $options); it should be $f = FeedReader::read('https://news.google.com/news/rss', 'default', $options); otherwise it will not load configuration.

I think it will be more flexible if to overwrite all options with passed to read() options instead of only curl options. It will be more flexible, the difference will be $f = FeedReader::read('https://news.google.com/news/rss', 'default', {'curl_options' => $curlOptions});. Also it will allow to add curl_options to config file.

It will require a bit more edits to pass $options array together with $configuration and overwrite options in readConfig() function. I can do this edits a bit later.

@RomainGoncalves
Copy link
Author

@vedmant Thanks for the nice words.
I'll be honest, I did this change because it's something that I need in my project right now. I did not anticipate to change all the options.
Would you be able to work on that on a subsequent PR and let this one be merged?
Also, I will work on the fact that users would have to write the default configuration.

@vedmant
Copy link
Owner

vedmant commented May 27, 2021

@RomainGoncalves Ok, I'll merge current PR, but I'll change it a bit later, to avoid breaking change could you just update to make it pass curl options as 'curl_options' key in array: $f = FeedReader::read('https://news.google.com/news/rss', 'default', {'curl_options' => $curlOptions});

@vedmant
Copy link
Owner

vedmant commented May 28, 2021

@RomainGoncalves Please fix ErrorException: Undefined index: curl_options, should be if (isset($options['curl_options'])) {

@RomainGoncalves
Copy link
Author

@vedmant sorry about that. Somehow the tests did not catch on it. Fixed now

@vedmant vedmant merged commit dd2031d into vedmant:master May 28, 2021
@RomainGoncalves RomainGoncalves deleted the allow-for-http-auth branch May 28, 2021 18:27
@RomainGoncalves
Copy link
Author

@vedmant quick question, is that change sent to packagist straight away? Can I update my dependencies and have the changes now?
Thanks

@vedmant
Copy link
Owner

vedmant commented May 28, 2021 via email

@RomainGoncalves
Copy link
Author

Thanks I saw that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants