php获取location,php获取header[‘location’]信息常见问题
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
總結
以上是生活随笔為你收集整理的php获取location,php获取header[‘location’]信息常见问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 年薪200万也留不住 台积电新人离职率高
- 下一篇: php对联广告,html左右对联代码 c