PHP retrieves the URL jump link

Source: Internet
Author: User
PHP retrieves the URL jump link $ url =
Http://s.click.taobao.com/t? E = m % 3D2% 26 s % 3DNUvtFDcIwOocQipKwQzePOeEDrYVVa64LKpWJ % quit
Jump
$ Result =
Http://item.taobao.com/item.htm? Id = 23547888655 & ali_trackid = 2: mm_41992893_0_0: 1385292898_6k3_1991321817

$ Url is a promotion link obtained from Alimama. the content on his page is JS, and he jumps to $ result through JS. I want to get $ result through $ url, can php encapsulate this function?


Reply to discussion (solution)


You have to check its js jump code first, and then simulate it with php.

You have to check its js jump code first, and then simulate it with php.

I tried this method, but I didn't figure it out;

Is there any other method, such as curl, fsockopen, get_headers, file_get_contents? what can be used to implement other methods?



You have to check its js jump code first, and then simulate it with php.

I tried this method, but I didn't figure it out;

Is there any other method, such as curl, fsockopen, get_headers, file_get_contents? what can be used to implement other methods?

Try this, http://blog.segmentfault.com/pcp/1190000000341558.

Php curl
Set curl_setopt ($ ch, CURLOPT_HEADER, true );
Obtain Location by regular expression in the returned information: part
Preg_match ('/^ Location :(? P .*?) $/M', $ hmtl, $ match)
Location: the following address is the address after the jump.

Technical stickers, learning .....

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.