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

How to use a proxy for $reader->load()? #84

Open
robertfausk opened this issue Oct 11, 2021 · 3 comments
Open

How to use a proxy for $reader->load()? #84

robertfausk opened this issue Oct 11, 2021 · 3 comments

Comments

@robertfausk
Copy link

My server has to use a proxy when reading feed.
Is it possible to configure the reader to use a proxy?

Or do I have to/can I use a workaround? E.g. load the content of the feed via another library, put it into a file and use the $reader->($localFilePath)?

@robertfausk
Copy link
Author

My current workaround is:

use Eko\FeedBundle\Feed\Reader;
use Goutte\Client;

$reader = new Reader();
$client = new Client();
$client->request('GET', $url);
$filename = \sprintf('%s%s%s', $this->cacheDir, \DIRECTORY_SEPARATOR, 'stellenticket.xml');
\file_put_contents($filename, $client->getInternalResponse()->getContent());
$items = $reader->load($filename);

I can provide a PR for the docs if wanted.

@eko
Copy link
Owner

eko commented Oct 12, 2021

Hi @robertfausk,

I think your workaround is the only solution available at this time.

To read feed, we are using https://github.com/laminas/laminas-feed/blob/2.16.x/src/Reader/Reader.php which does not seems to allow a proxy.

Thank you

@pueppiblue
Copy link

Looks like the reader allows you to set a http client
Laminas\Feed\Reader::setHttpClient.
We just miss a method to pass a client from Eko\FeedBundle\Feed\Reader to the laminas reader.

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

No branches or pull requests

3 participants