FreeBenzine Posted May 19, 2022 Report Share Posted May 19, 2022 Hi, I am trying to download xml file from URLs containing feeds using CURL using the following code. The code downloads the xml file for LINK1 (below, for RSS feeds). The code downloads a HTML file (instead of xml) for LINK2 (below, for Atom feeds). If I open LINK2 in a browser I can save it as a xml file. I do not understand why the code cannot download the xml file for LINK2. Any help will be highly appreciated. //$url = 'https://rss.sciencedirect.com/publication/science/00221694'; //LINK1 $url = 'https://onlinelibrary.wiley.com/feed/25780727/most-recent'; //LINK2 $curl = curl_init($url); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); $resp = curl_exec($curl); curl_close($curl); $myfile = fopen('x.xml', "w") or die("Unable to open file!"); fwrite($myfile, $resp); fclose($myfile); Quote Link to comment Share on other sites More sharing options...
FreeBenzine Posted May 21, 2022 Author Report Share Posted May 21, 2022 Seems nobody replies in this site Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.