Ossi
Ossi

Reputation: 808

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

Upvotes: 0

Views: 1601

Answers (1)

icktoofay
icktoofay

Reputation: 128993

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).

Upvotes: 2

Related Questions