• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Help with PHP

nag

New Member
I want to copy some of files so i used this code
Code:
<?php
$file = fopen("http://mysite.com/directory/firstfile.php", "r");
$my2=fopen("second.txt","w");
if (!$file) {
    echo "<p>Unable to open remote file for reading.\n";
    exit;
}
while(!feof($file)){
$naveed=fgets($file);
$go=fwrite($my2,$naveed);
}
fclose ($file);
?>
Although code will work but there is a problem that code takes a lot of time to execute when i tried it on http://tripod.co.uk message appeared ---exceeding time limit----
So can you tell me an alternate code which would do same but taking less time...as this takes a character write it to file and then takes a new character again write it to file so on....so takes much time.......
 
set_time_limit(number of seconds);

Try placing that at the start of your file. You will need to replace number of seconds with a number.
 
Back
Top