15/01/31
本文关键字: 302, header, location
//初始化url信息
$host= “#8221;;
$url=$host.”l/rzTf7ap2viw/&iid=222004556&resourceId=0_04_05_99/v.swf”;
//按照字段获取header响应信息
$headers = get_headers($url, TRUE);
//获取这个土豆的302跳转地址
$u302= $headers[“Location”];
正常状况下,的高级别apache和php版本 获取这个location是没有问题的,但是由于版本的弊端,有个别低版本,无法正常返回location信息,其他信息正常,测试其它跳转url,正常返回location信息。究其原因php header location,主要是location过长导致的。如下:
#038;swfPath=http://js。tudouui。com/bin/lingtong/SocialPlayer_148。swf&youkuId=XODgxOTM5MDAw&vcode=XODgxOTM5MDAw&lshare=1&listOwner=460446025&tvcCode=-1&tag=null&title=%E9%82%A3%E4%BA%9B%E5%B9%B4%E4%B8%8EDr。%E9%AD%8F%E7%BF%BB%E8%84%B8%E8%BF%87%E7%9A%84%E8%AF%84%E5%A7%94&mediaType=vi&totalTime=225470&hdType=3&hasPassword=0&nWidth=-1&isOriginal=0&channelId=31&nHeight=-1&banPublic=false&videoOwner=460446025&videoOwner=460446025&ocode=pdyocYRfWoc&tict=3&is1080p=0&hasWaterMark=0&totalTime=225470&channelId=31&cs=&k=&code=a9rf5GDdhhU&panelRecm=http://css。
tudouui。com/bin/lingtong/PanelRecm_9。swz&panelDanmu=http://css。tudouui。com/bin/lingtong/PanelDanmu_18。swz&panelEnd=http://css。tudouui。com/bin/lingtong/PanelEnd_13。swz&pepper=http://css。tudouui。com/bin/binder/pepper_17。png&panelShare=http://css。tudouui。com/bin/lingtong/PanelShare_7。swz&panelCloud=http://css。tudouui。com/bin/lingtong/PanelCloud_12。swz&autoPlay=false&listType=1&rurl=&resourceId=0_04_05_99&autostart=false&lid=21537817&lCode=NaeTFum4PsY&snap_pic=http%3A%2F%2Fr1。
ykimg。com%2F0541040854C9B0FE6A0A4E14293159E1&aopRate=0。01&p2pRate=0。95&adSourceId=99999&yjuid=null&yseid=1422598983263d9LR4n&yseidtimeout=1422629597814&yseidcount=2&uid=null&juid=0191ummk6k17lc&vip=0
另外也有个别服务器版本存在直接截断的弊端,就是显示这个url地址不完整。会把余下的location信息传输到下一个header的字段中php header location,这个可以检测输出可见。所以尝试输出的之后 可以考量合并处理 例如
$u302=$header[10].$header[11];
其他的一些hader信息获得普通方式网上有很多,这里就不再介绍了。
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-122273-1.html