所以我正在做一些PHP Corss-Origin处理和隧道化。 在远程服务器上,我有一个PHP编译一些文件,这可能需要一些时间,具体取决于请求的文件。 在另一台服务器上,我执行以下操作:
$file = "http://".$remote."/remote.php?prj=".$getprj;
$filename = substr($file,strrpos($file,"/")+1);
$fp = fopen($file, "r") or die("DEAD");
if(!headers_sent())
{
// http://php.net/manual/en/function.header.php#86554
// header("Content-Disposition: attachment; filename=".$filename);
header("Content-Disposition: attachment; "
.sprintf('filename="%s"; ', rawurlencode($filename))
.sprintf("filename*=utf-8''%s", rawurlencode($filename)));
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Description: File Transfer");
// header("Content-Length: " . filesize($filename));
}
flush(); // this doesn't really matter.
while (!feof($fp))
{
echo fread($fp, 65536);
flush(); // this is essential for large downloads
}
fclose($fp);
当我提出一个请求时,几秒钟后,它为我提供了下载。 当我提出另一个请求时,稍等片刻后又返回上述错误。
Warning: fopen(http://that.remote.server/remote.php?prj=tnt3): failed to open stream: HTTP request failed! in /.../current.php on line 18 DEAD
我几乎怀疑是超时,但是无法设置set_time_limit我无法确定。 我在这里有什么选择?