php - SimplePie on Azure not parsing https feeds -


i'm using compiled version of simplepie 1.4.2 (the last tagged version on github) aggregate rss/atom feeds (code below if needed).

it works on couple of linux-based web hosts, when upload azure app services http feeds display correctly, https don't.

why happens? no specific settings set on web app, using php 5.6 in both environments. no differences accessing azure web app through http or https.

thanks everybody!


<?php date_default_timezone_set('europe/rome'); set_time_limit(0); header('content-type: application/rss+xml; charset=utf-8'); require_once('simplepie.compiled.php');  [...]  echo '<?xml version="1.0" encoding="utf-8"?>';  ?> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/"> <channel> <title><?php echo $feedtitle; ?></title> <atom:link href="<?php echo $feedlink; ?>" rel="self" type="application/rss+xml" /> <link><?php echo $feedhome; ?></link> <description><?php echo $feeddesc; ?></description> <?php $feed = new simplepie(); $feed->set_feed_url($feeds); $feed->force_feed(true); $feed->init(); $feed->handle_content_type(); foreach($feed->get_items() $item) {     ?>     <item>         <title><?php echo $item->get_title(); ?></title>         <link><?php echo $item->get_permalink(); ?></link>         <guid><?php echo $item->get_permalink(); ?></guid>         <pubdate><?php echo $item->get_date('d, d m y h:i:s t'); ?></pubdate>         <dc:creator><?php if ($author = $item->get_author()) { echo $author->get_name()." @ "; }; ?><?php if ($feed_title = $item->get_feed()->get_title()) {echo $feed_title;}?></dc:creator>         <description><![cdata[<?php echo $item->get_content(); ?>]]></description>     </item>     <? }; ?> </channel> </rss> 

it dosen't work 'https' urls because simplepie leverages curl make http requests, , https requests, curl requires verify host or peer certificate.

you can try following code snippet bypass verification.

$simplepie = new simplepie(); $simplepie->set_curl_options(     array(         curlopt_ssl_verifyhost => false,         curlopt_ssl_verifypeer => false     ) ); 

here similar scenario @ https://github.com/simplepie/simplepie/pull/407


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -