Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Need copy() workaround
Old 01-30-2008, 06:34 AM Need copy() workaround
scrobins's Avatar
Skilled Talker

Posts: 50
Name: Stuart Robinson
Location: Busselton
Trades: 0
I have a site that's pulling a multifeed which is being copied to a static HTML page using the copy() function. I also have a cron job that's set to automate this process and continually deliver updated feeds.

My problem is that while the multifeed works well sometimes the html delivers a blank page - no navigation, no errors, no nothing....

Heres the code I'm using;

PHP Code:
$url "[site destination]";
//$sourcepage = "$url/php/express.php";
$sourcepage "$url/php/mm/index.php";
$tempfilename "/tmp/tmp_express.html";
$targetfilename "[index_file_path]/html/express.html";

$dynamic_source fopen($sourcepage'r'); 

if (!
$dynamic_source) {
echo 
"<strong>Unable to load $sourcepage
- Static page! Update Failed!</strong>"
;
exit();
}
$htmldata file_get_contents($sourcepage);
fclose($dynamic_source);
$tempfile fopen($tempfilename'w');
if (!
$tempfile) {
echo
"<strong>Unable to open temporary file $tempfilename for writing!
Static page update aborted!</strong>"
;
exit();
}
fwrite($tempfile$htmldata);
fclose($tempfile);
copy($tempfilename$targetfilename);
unlink($tempfilename);
echo 
"<strong>Express RSS Feeds Updated!</strong>"
Any ideas on why this is happening or what I could to circumvent it would be much appreciated.
scrobins is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-30-2008, 07:41 AM Re: Need copy() workaround
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
If you run this script as a cron job why not replace it with curl or wget?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Reply     « Reply to Need copy() workaround
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28727 seconds with 12 queries