Extralabs Software

Home Products Purchase Download Forum Contact Us
These forums are for user to user discussions only.
If you need 'official' technical support from our support staff and/or our developers,
please contact us by e-mail at support@extralabs.net


 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

cURL (PHP 5.2 URL file-access and fopen woes)

 
Post new topic   Reply to topic    www.extralabs.net Forum Index -> Feed2Html Feature Requests
View previous topic :: View next topic  
Author Message
dotbody



Joined: 21 Dec 2007
Posts: 2

PostPosted: Fri Dec 21, 2007 8:11 am    Post subject: cURL (PHP 5.2 URL file-access and fopen woes) Reply with quote

After spending several hours trying to implement this on a server that uses PHP5, i figured out that Feed2Html's current method of caching the XML file is a possible security risk (using fopen instead of curl)...

I noticed this when the script would only work if I put the .xml file in the same directory as the script. But calling other website scripts, or even different directories would give me Error: An error occured while parsing RSS file.

Have you guys heard of this? Is there an update you could make to the script that would fix this?
Back to top
View user's profile Send private message
Lukaslo



Joined: 20 Sep 2008
Posts: 1

PostPosted: Sat Sep 20, 2008 12:16 pm    Post subject: Reply with quote

I had the same problem and here is how I fixed it:

open rss_export.php
find
Code:
            if ($f = @fopen($cache_file, 'w')) {
               fwrite ($f, $serialized, strlen($serialized));
               fclose($f);
            }
            if ($result) $result['cached'] = 0;


replace with
Code:
   $ch = curl_init();
        $timeout = 5; // set to zero for no timeout
        curl_setopt ($ch, CURLOPT_URL, $rss_url);
        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
        $f = curl_exec($ch);
        curl_close($ch);


find
Code:
   if ($f = @fopen($rss_url, 'r')) {
         $rss_content = '';
         while (!feof($f)) {
            $rss_content .= fgets($f, 4096);
         }
         fclose($f);



replace with
Code:
   $ch = curl_init();
        $timeout = 5; // set to zero for no timeout
        curl_setopt ($ch, CURLOPT_URL, $rss_url);
        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
        $f = curl_exec($ch);
        curl_close($ch);
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.extralabs.net Forum Index -> Feed2Html Feature Requests All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Create RSS | Skype Recorder | Create RSS Feed | RSS Specification | RSS Software | RSS Creator | Submit RSS

Powered by PHPBB © 2001, 2005 phpBB Group