gwledig Posted April 21, 2009 Share Posted April 21, 2009 HI I'm working with Sharepoint which provides some pages as RSS, but the link is very messy and doesn't show up as an xml file which makes accessing the feed very hard for doing things like displaying RSS on a public Web page. Basically I want to save the RSS url/page contents (the feed url) to a file (.xml) which seems to work better with rss readers and stuff. so here is a script I've been trying to use to basically save the page as an xml file: <?php $remoteFileContents=file_get_contents("https://vocal-external.liv.ac.uk/sites/catherallp-test/news/_layouts/listfeed.aspx?List={C1F668FA-F047-427F-93B0-8344EA008518}"); $localFilePath = "C:\Mowes\www"; $localFileName = "ok.xml"; $newFileHandle = fopen($localFilePath."/".$localFileName, "w"); fwrite($newFileHandle, $remoteFileContents); fclose($newFileHandle); ?> Unfortunately I get this error when running the php: ---------------------------------------- Warning: file_get_contents(https://vocal-external.liv.ac.uk/sites/catherallp-test/news/_layouts/listfeed.aspx?List={C1F668FA-F047-427F-93B0-8344EA008518}) [function.file-get-contents]: failed to open stream: Invalid argument in C:\Mowes\www\saverss.php on line 2 ---------------------------------------- I've been using MOWES version of apache server which uses php 4 and also has 5 (I assume it's using 5). Any ideas much appreciated!!! Gwledig Link to comment https://forums.phpfreaks.com/topic/155026-saving-web-version-of-rss-to-local-file-in-php/ Share on other sites More sharing options...
rhodesa Posted April 21, 2009 Share Posted April 21, 2009 Try using Curl: <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://vocal-external.liv.ac.uk/sites/catherallp-test/news/_layouts/listfeed.aspx?List={C1F668FA-F047-427F-93B0-8344EA008518}'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $remoteFileContents = curl_exec($ch); $localFilePath = "C:\Mowes\www"; $localFileName = "ok.xml"; $newFileHandle = fopen($localFilePath."/".$localFileName, "w"); fwrite($newFileHandle, $remoteFileContents); fclose($newFileHandle); ?> Link to comment https://forums.phpfreaks.com/topic/155026-saving-web-version-of-rss-to-local-file-in-php/#findComment-815377 Share on other sites More sharing options...
gwledig Posted April 21, 2009 Author Share Posted April 21, 2009 it took a while to get CURL working on my mickey mouse MOWES server but this does in fact work !!!! thanks a bundle! gwledig Link to comment https://forums.phpfreaks.com/topic/155026-saving-web-version-of-rss-to-local-file-in-php/#findComment-815385 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.