某些网站通过http header信息限制下载文件,在linux下面可以使用wget来模拟realplay等的,http header信息。
wget --head "ClientID: WinNT_5.0_6.0.12.1056_play32_R30CND_zh-CN_686_axembed" --head "User-Agent: RMA/1.0 (compatible; RealMedia)" http://localhost/head.php
说明:每一个header信息项用一个 --head参数来指定,可以多次使用 --head参数。
下面是我的http://localhost/head.php获得的header的信息:(关于php操作http header 参见:http://blog.csdn.net/islq/archive/2006/07/08/893434.aspx)
Array
(
[User-Agent] => RMA/1.0 (compatible; RealMedia)
[Accept] => */*
[Host] => localhost
[Connection] => Keep-Alive
[ClientID] => WinNT_5.0_6.0.12.1056_play32_R30CND_zh-CN_686_axembed
)
以下是下载成功和不成功的http链接信息记录:
> >从IE点播的http请求,播放成功。(VOD1.cap)
> >
> >GET /vod2/%5bTV%5dFZXF/01.rmvb HTTP/1.1
> >
> >Accept: */*
> >
> >User-Agent: RMA/1.0 (compatible; RealMedia)
> >
> >Icy-MetaData: 1
> >
> >Bandwidth: 10485800
> >
> >ClientID: WinNT_5.0_6.0.12.1056_play32_R30CND_zh-CN_686_axembed
> >
> >GUID: 00000000-0000-0000-0000-000000000000
> >
> >Language: zh-CN, zh, *
> >
> >RegionData: 0
> >
> >SupportsMaximumASMBandwidth: 1
> >
> >Connection: Keep-Alive
> >
> >Host: 10.146.189.104
> >
> >Accept-Language: zh-CN, zh, *
> >
> >Accept-Encoding: gzip
> >
> >===================================================================
> >从realplayer直接打开对应文件播放成功。(vod2.cap)
> >
> >GET /vod2/%5bTV%5dFZXF/01.rmvb HTTP/1.1
> >
> >Accept: */*
> >
> >User-Agent: RMA/1.0 (compatible; RealMedia)
> >
> >Icy-MetaData: 1
> >
> >Bandwidth: 10485800
> >
> >ClientID: WinNT_5.0_6.0.12.1056_RealPlayer_R30CND_zh-CN_686
> >
> >GUID: 00000000-0000-0000-0000-000000000000
> >
> >Language: zh-CN, zh, *
> >
> >RegionData: 0
> >
> >SupportsMaximumASMBandwidth: 1
> >
> >Connection: Keep-Alive
> >
> >Host: 10.146.189.104
> >
> >Accept-Language: zh-CN, zh, *
> >
> >Accept-Encoding: gzip
> >
> >
> >===================================================================
> >从IE直接下载该文件失败(vod3.cap)
> >GET /vod2/%5bTV%5dFZXF/01.rmvb HTTP/1.1
> >
> >Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
> >
> >Accept-Language: zh-cn
> >
> >Accept-Encoding: gzip, deflate
> >
> >User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; MyIE2)
> >
> >Host: 10.146.189.104
> >
> >Connection: Keep-Alive
> >
> >
> >
> >HTTP/1.1 403 Forbidden
> >
> >Date: Tue, 04 Jul 2006 16:33:16 GMT
> >
> >Server: Apache/2.0.52 (Unix) PHP/4.3.10
> >
> >Content-Length: 312
> >
> >Keep-Alive: timeout=15, max=100
> >
> >Connection: Keep-Alive
> >
> >Content-Type: text/html; charset=iso-8859-1
> >
> >
> >
> >
> >
> >
403 Forbidden> >
> >
Forbidden
> >
You don't have permission to access /vod2/[TV]FZXF/01.rmvb
> >on this server.
> >
> >
Apache/2.0.52 (Unix) PHP/4.3.10 Server at 10.146.189.104 Port 80> >
> >
> >
> >===================================================================
> >迅雷下载失败(vod4.cap)
> >GET /vod2/%5bTV%5dFZXF/01.rmvb HTTP/1.1
> >
> >Host: 10.146.189.104
> >
> >Accept: */*
> >
> >User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)
> >
> >Referer: http://10.146.189.104/vod2/%5bTV%5dFZXF
> >
> >Pragma: no-cache
> >
> >Cache-Control: no-cache
> >
> >Connection: close
> >
> >
> >
> >HTTP/1.1 403 Forbidden
> >
> >Date: Tue, 04 Jul 2006 16:36:20 GMT
> >
> >Server: Apache/2.0.52 (Unix) PHP/4.3.10
> >
> >Content-Length: 312
> >
> >Connection: close
> >
> >Content-Type: text/html; charset=iso-8859-1
> >
> >
> >
> >
> >
> >
403 Forbidden> >
> >
Forbidden
> >
You don't have permission to access /vod2/[TV]FZXF/01.rmvb
> >on this server.
> >
> >
Apache/2.0.52 (Unix) PHP/4.3.10 Server at 10.146.189.104 Port 80> >
> >
> >
> >===================================================================
> >flashget下载失败(vod5.cap)
> >
> >GET /vod2/%5bTV%5dFZXF/01.rmvb HTTP/1.1
> >
> >Host: 10.146.189.104
> >
> >Accept: */*
> >
> >Referer: http://www.freescale.com.cn/Applications/automotive_mpc5200.asp
> >
> >User-Agent: Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)
> >
> >Pragma: no-cache
> >
> >Cache-Control: no-cache
> >
> >Connection: close
> >
> >
> >
> >HTTP/1.1 403 Forbidden
> >
> >Date: Tue, 04 Jul 2006 16:41:39 GMT
> >
> >Server: Apache/2.0.52 (Unix) PHP/4.3.10
> >
> >Content-Length: 312
> >
> >Connection: close
> >
> >Content-Type: text/html; charset=iso-8859-1
> >
> >
> >
> >
> >
> >
403 Forbidden> >
> >
Forbidden
> >
You don't have permission to access /vod2/[TV]FZXF/01.rmvb
> >on this server.
> >
> >
Apache/2.0.52 (Unix) PHP/4.3.10 Server at 10.146.189.104 Port 80> >