how to find out new location from 302 header

Alles, was PHP betrifft, kann hier besprochen werden.

how to find out new location from 302 header

Postby mamun » 24. October 2010 14:31

Hi
I use curl to grab a page of a website. Suppose the url of that page was like this:

http://www.example.com/pageA.php?file=onefile


Recently that site applied a 302 redirection in pageA.php, so that when I try to grab the page from that url it shows me a 302 redirection with new location like this:

Location: /pageA.php?file=onefile?230562

As far I know, if I type this new location into browser's address field or grab that new location by curl, it should be shown by browser or curl should grab it from new location. But watch on the new location string. It has double "?" marks, one as a GET parameter and second one is created as a redirection to the new location. So if I type-

http://www.example.com/pageA.php?file=onefile?230562

on browser's address field or set it as a CURLOPT_URL value, neither the browser shows it nor the curl can grab it as two "?" marks is invalid in a same url. But if I browse the http://www.example.com/pageA.php?file=onefile (without ?230562), browser shows me the content from the new location. So the new location is not invalid actually and browser can identify the new location from header. I think there is a replacement or special meaning of second "?" mark in the new location of 302 message.

Does anyone have any idea what should I write in the browser's address field or as a value of the CURLOPT_URL to grab the page from new location?

Regards
infomamun
mamun
 
Posts: 1
Joined: 24. October 2010 14:18

Return to PHP

Who is online

Users browsing this forum: No registered users and 36 guests