Problem with remote reading and loading...
Posted: Thu Oct 21, 2004 2:19 pm
Hi all. This is my problem.
I'm trying to remotely read a file and write it to my server.
I've managed to do this, but, I have a slight problem:
When I have a link like this one:
http://www.bfpirates.com/links.php?action=go&link_id=34
I don't know the actual name of the file I want to read so I can't read it remotely with the fopen function.
When I actually click it, everything works just fine, and I can download the file normally but when I try to open it using fopen, I get an error saying CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers..
Is there a way to read remotely (probably they are somehow redirected) files placed at links like this one?
I think it should be possible because web browser can get a direct link, so I should be able to get it too.
Please help!
I have 1 more problem:
I use this code:
But, on 1 server I have a problem with script execution time :
Fatal error: Maximum execution time of 30 seconds exceeded in .....\remoteCopy.php on line 42, and on the other, I have an error that says: Fatal error: Allowed memory size of 12582912 bytes exhausted (tried to allocate 65537 bytes) in /home/.../sas-ukclan.co.uk/user/htdocs/remoteCopy.php on line 42
When 1st error ocured (timeout) I tried to copy http://www.nuspojava.com/pvt/packet.zip
When 2nd error occured, I tried to copy http://www.bfpirates.com/links.php?action=go&link_id=34 file.
Well, http://www.nuspojava.com/pvt/packet.zip works just fine on the second server that reported second error on the bfpirates... etc file.
Please help!
I'm trying to remotely read a file and write it to my server.
I've managed to do this, but, I have a slight problem:
When I have a link like this one:
http://www.bfpirates.com/links.php?action=go&link_id=34
I don't know the actual name of the file I want to read so I can't read it remotely with the fopen function.
When I actually click it, everything works just fine, and I can download the file normally but when I try to open it using fopen, I get an error saying CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers..
Is there a way to read remotely (probably they are somehow redirected) files placed at links like this one?
I think it should be possible because web browser can get a direct link, so I should be able to get it too.
Please help!
I have 1 more problem:
I use this code:
Code: Select all
function tool_copy($sourceFile, $destinationDirectory, $newFile, $cSpeed=65536)
{
$fullRemoteFilePath = $sourceFile;
$destinationPath = $destinationDirectory;
$newFileName = $newFile;
$speed = $cSpeed;
$cpdata = ""; //buffer
$check = @fopen($fullRemoteFilePath,"rb");
if(!$check)
{
print("<br />Fatal error: requested file ($fullRemoteFilePath) is NOT reachable!<br />");
print("Please check if the file path is correct and that you are grandet full access to the file!<br />");
print("<a href="remoteCopy.php">Try again!</a>");
fclose($fp);
}
else
{
$fp = @fopen($fullRemoteFilePath, "rb");
do {
$data = fread($fp, $speed);
if (strlen($data) == 0) {
break;
}
$cpdata .= $data;
} while(true);
fclose($fp);
$checked = @fopen($destinationPath."".$newFileName, "wb+");
if(!checked)
{
print("<br />Fatal error: destination path of filename ($fullRemoteFilePath) is NOT accessible!<br />");
print("Please check if the file path is correct and that you are grandet full access to the path(file)!<br />");
print("<a href="remoteCopy.php">Try again!</a>");
fclose($fp);
}
else
{
$fp = @fopen($destinationPath."".$newFileName, "wb+");
@fwrite($fp, $cpdata);
fclose($fp);
print("Requested file coppied correctly!<br />");
print("<a href="remoteCopy.php">Try a next one?</a>");
}
}
}Fatal error: Maximum execution time of 30 seconds exceeded in .....\remoteCopy.php on line 42, and on the other, I have an error that says: Fatal error: Allowed memory size of 12582912 bytes exhausted (tried to allocate 65537 bytes) in /home/.../sas-ukclan.co.uk/user/htdocs/remoteCopy.php on line 42
When 1st error ocured (timeout) I tried to copy http://www.nuspojava.com/pvt/packet.zip
When 2nd error occured, I tried to copy http://www.bfpirates.com/links.php?action=go&link_id=34 file.
Well, http://www.nuspojava.com/pvt/packet.zip works just fine on the second server that reported second error on the bfpirates... etc file.
Please help!