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
Help sending file among server..
Old 01-29-2010, 01:07 PM Help sending file among server..
Junior Talker

Posts: 1
Name: Michele
Trades: 0
Hi all, my name is Michele and
I want to download a file from an internet server and save the file in my server.
I use this code (this code run on a hosting X without errors)

<?php
//Dir src
$src_rep_win="http://www.threebestdogs.com/wp-content/gallery/aidi/";
//File
$file_win="aidi03.jpg";
//Dir dest
$dest_rep_win="";

//time to limit
$ttl=500;

function save_nightly_build($src_rep,$dest_rep,$file) {
//copy remote file
set_time_limit($ttl);
//Check if file exists
if(!file_exists($dest_rep.$file)){
//open src file
$srcfile = fopen($src_rep.$file, "r");
//open local file
$flocal = fopen($dest_rep.$file,"w");
//write local file
while ($contents = fread( $srcfile, 8192)) {
fwrite( $flocal, $contents, strlen($contents) );
}
//close the two files
fclose($srcfile);
fclose($flocal);
}
}

save_nightly_build($src_rep_win,$dest_rep_win,$fil e_win);

?>

But in my actual hosting I receive this errors:

Gateway Time-out
The gateway did not receive a timely response from the upstream server or application.

and in log:

Timeout waiting for output from CGI script /web/htdocs/www.. script address.

The script "works" and I really have a copy on my server but I have also these errors.

Someone could help me in debugging?

Thank you in advance,
Michele Alletto

PS the src server works very well!!
mikall is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-30-2010, 01:46 AM Re: Help sending file among server..
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
PHP Code:
$cmd "wget -O {$local_file} {$remote_file} > {$local_file}.log &";
exec($cmd$out$ret); 
And what is the "CGI script /web/htdocs/www.. script address" here? A script on receiving server or a script on threebestdogs?
__________________

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 Help sending file among server..
 

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.09961 seconds with 12 queries