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

[BUG] When proxy is used in SimplePie, error is returned: A feed could not be found at https://www.newsblog.gr/feed/; the status code is 200 and content-type is `` #664

Open
sfatfarma opened this issue Dec 9, 2020 · 1 comment
Labels

Comments

@sfatfarma
Copy link

sfatfarma commented Dec 9, 2020

Description

I am facing an interesting issue while using SimplePie. It manages to parse the following feed without issues https://www.newsblog.gr/feed/ , however, once I configure SimplePie to use a proxy, the following error is returned when trying to parse the above feed:

A feed could not be found at https://www.newsblog.gr/feed/; the status code is 200 and content-type is `` in \simplepie\library\SimplePie.php on line 1702

Steps to Reproduce

Steps to reproduce the behavior:

  1. Set up SimplePie to get content from https://www.newsblog.gr/feed/ (this is working)
$feed = new SimplePie();
$feed->set_feed_url('https://www.newsblog.gr/feed/');
$feed->init();
$feed->handle_content_type();
if ($feed->error()) {
    error_log('feed error: '. $feed->error());
}
  1. Add also the usage of a proxy to the request:
$feed = new SimplePie();
$prx_arr = array();
$prx_arr[CURLOPT_PROXY] = 'proxyIP:port';
$prx_arr[CURLOPT_PROXYUSERPWD] = 'proxyUser:pass';
$feed->set_curl_options($prx_arr);
$feed->set_feed_url('https://www.newsblog.gr/feed/');
$feed->init();
$feed->handle_content_type();
if ($feed->error()) {
    error_log('feed error: '. $feed->error());
}

Don't forget to replace the 'proxyIP:port' and 'proxyUser:pass' fields with working proxy server parameters.

Also, as a side note, while using the proxy, the following PHP warning is raised:

Undefined index: content-type in \simplepie\library\SimplePie.php on line 1643

Expected Behavior

Feed to be able to be loaded even if a proxy is used in SimplePie.

Actual Behavior

Feed failed to be loaded when a proxy is used.

@sfatfarma sfatfarma added the bug label Dec 9, 2020
@sfatfarma sfatfarma changed the title [BUG] Feed is not able to be processed by SimplePie when a proxy is used in SimplePie curl (A feed could not be found at https://www.newsblog.gr/feed/; the status code is 200 and content-type is ``) [BUG] When proxy is used in SimplePie, error is returned: A feed could not be found at https://www.newsblog.gr/feed/; the status code is 200 and content-type is `` Dec 9, 2020
@skyzyx skyzyx removed their assignment Aug 10, 2021
@KW4NP
Copy link

KW4NP commented Aug 11, 2022

I'm having this issue as well with a different feed. The feed works fine on the demo but occasionally returns errors, maybe an intermittent??
PHP Notice: Trying to access array offset on value of type bool in simplepie/library/SimplePie.php on line 1722
PHP Notice: A feed could not be found at https://tchadinfos.com/feed/; the status code is 200 and content-type is `` in /simplepie/library/SimplePie.php on line 1766
This link seems to be relevant but I'm not sure where to insert the code mentioned. https://stackoverflow.com/questions/42211661/simplepie-not-parsing-rss-feed
Using SimplePie 1.6

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

No branches or pull requests

3 participants