Sometimes you can get an error when trying to request a feed using https.
[Zend\Http\Client\Adapter\Exception\RuntimeException]
Unable to enable crypto on TCP connection domain.tld: make sure the "sslca
file" or "sslcapath" option are properly set for the environment.
[ErrorException]
stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Using ...
use Zend\Feed\Reader\Reader as ZendFeedReader;
use Zend\Http\Client as ZendHttpClient;
/** @var \Eko\FeedBundle\Feed\Reader $FeedReader */
$FeedReader = $this->getContainer()->get('eko_feed.feed.reader');
$httpClientOptions = array(
'adapter' => 'Zend\Http\Client\Adapter\Socket',
'persistent'=>false,
'sslverifypeer' => false,
'sslallowselfsigned' => true,
'sslusecontext'=>true,
'ssl' => array(
'verify_peer' => false,
'allow_self_signed' => true,
'capture_peer_cert' => true,
),
'useragent' => 'Feed Reader',
);
ZendFeedReader::setHttpClient(new ZendHttpClient(null, $httpClientOptions));
/** @var \Zend\Feed\Reader\Feed\FeedInterface $Feed */
$Feed = $FeedReader->load('domain.tld/rss')->get();
Problem
Sometimes you can get an error when trying to request a feed using https.
Workaround
If you doesn't care about SSL certificates you can do this:
Using ...
Controller / Command: