Home > Backend Development > PHP Tutorial > 怎么获取一个网址跳转后的地址

怎么获取一个网址跳转后的地址

WBOY
Release: 2016-06-13 11:49:50
Original
2910 people have browsed it

如何获取一个网址跳转后的地址?
如:http://s.click.taobao.com/t?e=m%3D2%26s%3DYiJz231K878cQipKwQzePOeEDrYVVa64K7Vc7tFgwiFRAdhuF14FMXNqXXOUZuFRlovu%2FCElQOv6KEOZrBczXkKQIyb6a3ytqFkRdDwqYqPEwTsG41P5gZRWH38H64HnomfkDJRs%2BhU%3D&unid=41Tr3
这个地址打开后浏览器上显示的真实地址是
http://re.taobao.com/eauction?e=%2BxVQEg64bTgjmraEDZVrLivdVbwI2XBiHXoLCLLzzT6LltG5xFicOcdl4%2FC0GneLDPIwxrc30rgOiisYMpl%2Fi6dkxT%2BbrdGaTV8QlbynBnOSNCUsC%2FYwFNN0cMjbIKmK&ptype=100010&unid=41Tr3&from=basic&ali_trackid=2:mm_16674950_0_0,41Tr3:1386652869_6k2_781266833
如何用php获得这个真实地址呢(模拟访问获取也可以的)


获取到下面这一步就死了
nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">




<script><br />function htmlspecialchars(str){ <br /> str = str.replace(/, '<');<br /> str = str.replace(/>/g, '>');<br /> str = str.replace(/"/g, '"');<br /> str = str.replace(/'/g, '&#039;');<br /> return str;<br />}<br /><br />function bol(){<br /> if (top.location != self.location) {<br /> return false;<br /> }<br /><br /> var qs = location.search.split("?")[location.search.split("?").length-1].split("&");<br /> qso = {};<br /> for (var i=0; i<qs.length; i++){<br /> if (qs[i]!="") {<br /> var tmpa = qs[i].split("=");<br /> qso[tmpa[0]] = tmpa[1] ? tmpa[1] : "";<br /> }<br /> }<br /> <br /> var tu = unescape(qso.tu);<br /> if (htmlspecialchars(tu).length != tu.length) {<br /> exit;<br /> }<br /> <br /> if (qso.tu && (qso.tu.indexOf("http%3A%2F%2Fs.click.taobao.com%2F")===0<br /> || qso.tu.indexOf("http%3A%2F%2Fi.click.taobao.com%2F")===0<br /> || qso.tu.indexOf("http%3A%2F%2Fs.click.alimama.com%2F")===0<br /> || qso.tu.indexOf("http%3A%2F%2Fitem8.taobao.com%2F")===0<br /> || qso.tu.indexOf("http%3A%2F%2Fshop8.taobao.com%2F")===0)) {<br /> if (!window.attachEvent) {<br /> document.write('<input style="display:none" type="button" id="exe" value="" onclick="window.location=\''+unescape(qso.tu)+'\'">');<br /> document.getElementById('exe').click();<br /> } else {<br /> document.write('<a style="display:none" href="'+unescape(qso.tu)+'" id="exe">');<br /> document.getElementById('exe').click();<br /> }<br /> }<br />}//end of bol()<br />bol();<br /></script>


------解决方案--------------------
不要为 php 做不到的事情劳神费力了
电商为保护他们的数据所做的努力也不是白费的
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template