How to get the URL after this URL jump through PHP

Source: Internet
Author: User
How to get the URL after this URL jump through PHP
http://www.chong4.com.cn/cydb/go.php?7218_29882_22t

How he jumps ~~
How to get the URL after this URL jump through PHP


Reply to discussion (solution)

If the jump is not in the code, it is estimated that the header can be caught only through socket.

Curl also seems to have obtained the header. check it.

It is estimated that the redirection is implemented based on the following variables.

The fsockopen method obtains the page, analyzes the Location in it, and obtains the jump address.

$headers = get_headers('http://www.chong4.com.cn/cydb/go.php?7218_29882_22t', true);if(is_array($headers['Location'])){    $headers['Location'] = array_pop($headers['Location']);}$script = file_get_contents($headers['Location']);echo $script;

Its final jump is like JavaScript. the simple method is to find out its rule and extract its URL content.

Jump to 'http: // s.click.taobao.com/t_js through 302? Tu = http % 3A % 2F % samples % 2Ft % 3Fe % 3DzGU34CA7K % 252BPkqB07S4% samples % %%252f9fhp6i % 252 FPRGYAGeegVo % 252F % 26spm % 3D2014. 12231445.1.0% 26u % 3D22t7218% 26ref % 3D % 26et % 3DjFBB1tzvZVjt5A % 253D % 253D
You can get a piece of js code.
Qs = location. search. split ("? ") [Location. search. split ("? "). Length-1]. split ("&");
Therefore, you need to replace location. search with the above url.
After the js code is executed
Type = text/javascript charset = UTF-8> SCRIPT

Type = text/javascript charset = UTF-8> SCRIPT

Type = text/javascript charset = UTF-8> SCRIPT

Type = text/javascript charset = UTF-8> SCRIPT
FrameBorder = 0>FrameBorder = 0>

You can continue to track the code in those js files.

This post was last edited by xuzuning at 13:01:04
Jump to 'http: // s.click.taobao.com/t_js through 302? Tu = http % 3A % 2F % 2Fs.click.taobao.com % 2Ft % 3Fe % 3DzGU34CA7K % 252BPkqB07S4% 252FK0CFcRfH0G7DbPki ......


http://s.click.taobao.com/t_js?tu=http%3A%2F%2Fs.click.taobao.com%2Ft%3Fe%3DzGU34CA7K%252BPkqB07S4%252FK0CFcRfH0G7DbPkiN9MMH7EkQ%252B3KnWlM5fPrbcF5EKeNJ3Ts8ijJ4%252F77oX8O2iw1qEuhEhgaut73j9hJ3YPtNYm616DyrkK0aE1E31WN8TefmpCriY9EJ5O4JCWiRap3Rj1hfNxI2HSqhk8lK01rAylx5%252F9fHp6i%252FPRGYAGeegVo%252F%26spm%3D2014.12231445.1.0%26u%3D22t7218%26ref%3D%26et%3DjFBB1tzvZVjt5A%253D%253D

What we need is this section. how can we get it?

$url = 'http://www.chong4.com.cn/cydb/go.php?7218_29882_22t';$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_HEADER, true);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);$content = curl_exec($ch);echo $content;
Get

HTTP/1.1 301 Moved Permanently
Server: nginx/1.0.15
Date: Thu, 17 Jan 2013 06:48:10 GMT
Content-Type: text/html
Connection: keep-alive
X-Powered-By: PHP/5.2.17
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Last-Modified: Thu, 17 Jan 2013 06:48:10 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Location: http://s.click.taobao.com/t? E = zGU34CA7K % 2BPkqB07S4% pushed % 2F9fHp6i % 2 FPRGYAGeegVo % 2F & spm = 2014.12231445.1.0 & u = 22t7218
Content-Length: 0

HTTP/1.1 302 Moved Temporarily
Server: Tengine
Date: Thu, 17 Jan 2013 06:48:22 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: close
Location: http://s.click.taobao.com/t_js? Tu = http % 3A % 2F % samples % 2Ft % 3Fe % 3DzGU34CA7K % 252BPkqB07S4% samples % %%252f9fhp6i % 252 FPRGYAGeegVo % 252F % 26spm % 3D2014. 12231445.1.0% 26u % 3D22t7218% 26ref % 3D % 26et % 3DjFBB1ttOjF2GRA % 253D % 253D
Expires: Thu, 17 Jan 2013 06:48:22 GMT
Cache-Control: max-age = 0

HTTP/1.1 200 OK
Server: Tengine
Date: Thu, 17 Jan 2013 06:48:22 GMT
Content-Type: text/html; charset = GBK
Content-Length: 2267
Last-Modified: Tue, 15 Jan 2013 01:49:17 GMT
Connection: close
Vary: Accept-Encoding
Expires: Thu, 17 Jan 2013 06:48:22 GMT
Cache-Control: max-age = 0
Accept-Ranges: bytes






Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.