Biw*_*iwu 5 php cookies curl filesize
我在两个不同的服务器上使用这个脚本:
function curlGetFileInfo($url, $cookies="default"){
global $_config;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'serverpath/cookies/'.$cookies.'.txt');
$data = curl_exec($ch);
curl_close($ch);
if ($data === false) {
return 0;
}
//echo $data;
$info['filename'] = get_between($data, 'filename="', '"');
$info['extension'] = end(explode(".",$info['filename']));
if (preg_match('/Content-Length: (\d+)/', $data, $matches)) {
$info['filesize'] = (int)$matches[1];
}
return $info;
}
Run Code Online (Sandbox Code Playgroud)
这些服务器具有相同的 PHP 版本和相同的 PHP-Curl 版本。这些是 curl 结果的两个不同标题:
工作一:
HTTP/1.1 302 发现日期:2012 年 6 月 12 日星期二 07:04:35 GMT 服务器:Apache/2.2.16 (Debian) X-Powered-By:PHP/5.3.3-7+squeeze13 到期:1981 年 11 月 19 日星期四08:52:00 GMT Cache-Control: no-store, no-cache,must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Location: http://stor1076.uploaded.to/ dl/b3411ded-0f45-4efc-b705-8c8ac89b5e41 变化:接受编码连接:关闭内容类型:text/html HTTP/1.1 200 OK 服务器:nginx/1.0.5 日期:2012 年 6 月 12 日星期二 07:04:35 GMT 内容类型:video/x-msvideo 内容长度:733919232 上次修改时间:2012 年 5 月 29 日星期二 15:10:07 GMT 连接:保持活动内容处理:附件;filename="Saw.[Spanish.DVDRip].[XviD-Mp3].by.SDG.avi" 接受范围:字节
非工作一:
HTTP/1.1 302 发现日期:2012 年 6 月 12 日星期二 07:05:26 GMT 服务器:Apache/2.2.16 (Debian) X-Powered-By:PHP/5.3.3-7+squeeze13 到期:1981 年 11 月 19 日星期四08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Location: http://stor1164.uploaded.to/ dl/22c3d242-365d-4e1e-b903-f1e2b81812c2 变化:接受编码连接:关闭内容类型:文本/html
Cookie 设置正常(使用登录),其他简单的 Curl 功能运行良好。
另外,我做了一个curl_getinfo($ch, CURLINFO_HTTP_CODE)并给了我这个结果:
工作一: 200
非工作一: 302
任何的想法?
| 归档时间: |
|
| 查看次数: |
436 次 |
| 最近记录: |