NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Seeking php help converting fopen to curl

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 08-29-2007, 02:59 AM THREAD STARTER               #1 (permalink)
New Member
Join Date: Aug 2007
Posts: 2
AshleyQuick is an unknown quantity at this point
 



Seeking php help converting fopen to curl


Here's the part of the code that uses the fopen methodology:

PHP Code:
$file SAMPLE_FILE '.' $zip '.xml';
????: NamePros.com http://www.namepros.com/programming/367696-seeking-php-help-converting-fopen-curl.html
if(!
file_exists($file) || filemtime($file) < time() - 3600) {
    
$this->data = @file_get_contents('http://xml.mydomain.com/rss?p=' $zip '&u=' $units['zap']);
    
$fp = @fopen($file'w');
    @
fwrite($fp$this->data);
    @
fclose($fd);
}
else 
$this->data = @file_get_contents($file);
if(
strlen($this->data) <= 0) return; 
AshleyQuick is offline  
Old 08-30-2007, 06:40 PM   #2 (permalink)
cef
NamePros Regular
Join Date: May 2004
Location: NYC
Posts: 236
cef is a jewel in the roughcef is a jewel in the roughcef is a jewel in the rough
 


Animal Rescue
Use this for your 'if' block:

PHP Code:
    if(!file_exists($file) || filemtime($file) < time() - 3600
    {
        
$ch = @curl_init('http://xml.mydomain.com/rss?p=' urlencode($zip) . '&u=' urlencode($units['zap']));
        
$fp = @fopen($file,'w');
        @
curl_setopt($chCURLOPT_FILE$fp);
        @
curl_setopt($chCURLOPT_HEADER0);
        @
curl_exec($ch);
????: NamePros.com http://www.namepros.com/showthread.php?t=367696
        @
curl_close($ch);
        @
fclose($fp);
    } 
cef is offline  
Old 08-31-2007, 11:26 AM   #3 (permalink)
cef
NamePros Regular
Join Date: May 2004
Location: NYC
Posts: 236
cef is a jewel in the roughcef is a jewel in the roughcef is a jewel in the rough
 


Animal Rescue
Minor adjustments and corrections. Here's the working fragment:

PHP Code:
 if(!file_exists($file) || filemtime($file) < time() - 3600
????: NamePros.com http://www.namepros.com/showthread.php?t=367696
    {
        
$ch = @curl_init('http://xml.mydomain.com/rss?p=' urlencode($zip) . '&u=' urlencode($units['zap']));
        
$fp = @fopen($file,'w');
        @
curl_setopt($chCURLOPT_FILE$fp);
        @
curl_setopt($chCURLOPT_HEADER0);
        @
curl_setopt($chCURLOPT_MUTE1);
        @
curl_exec($ch);
        @
curl_close($ch);
        @
fclose($fp);
    }  

 
$this->data = @file_get_contents($file);
 if(
strlen($this->data) <= 0) return; 
????: NamePros.com http://www.namepros.com/showthread.php?t=367696
cef is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 02:24 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger