简体   繁体   中英

get 302 redirect url using php

I was able to use How To Get Redirect URL In PHP

but now it does not work anymore. site where I try to get redirect url is using temporary 302 redirection. It gives me "05 Request method 'HEAD' not supported"

Only way for me to see "link" if I put get_headers in my script, I will get bunch of stuff and I see redirect displayed in "[Cache-Control] => private [Location] => http://www.test.com " towards end.

How do I modify above script to work with this new 302 redirect? Thanks

If the server doesn't support HEAD , you could retry with GET . Make sure that if you do this you only search for the Location header in the headers (not in the body).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM