Getting header information from remote server

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
nutkenz
Forum Contributor
Posts: 155
Joined: Tue Jul 19, 2005 12:25 pm

Getting header information from remote server

Post by nutkenz »

I could only find a tool to get me the code response (which was 302), but I'd like to know exactly where the URL somethingsomething is referring me to. How do I find this information? If someone knows of a PHP script to do this, that's great, but an online tool, such as http://urlencode.de/ would be even better.
Last edited by nutkenz on Tue Nov 28, 2006 4:02 pm, edited 1 time in total.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

I probably misunderstand you.. In case you recieve a 302 status code you also recieve a header with key: "Location" that contains he URI...


From http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field.

The temporary URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s).

If the 302 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.
nutkenz
Forum Contributor
Posts: 155
Joined: Tue Jul 19, 2005 12:25 pm

Post by nutkenz »

Well, the tool I used only showed the code unfortunately...
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Then it's time to read the manual of your tool.. Or get a tool that does what you want it to do.
nutkenz
Forum Contributor
Posts: 155
Joined: Tue Jul 19, 2005 12:25 pm

Post by nutkenz »

Well, that's why I'm here. In case someone knows of a tool that does show the location as well...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You could simply make it... it's not all that difficult.

If you have a new enough version of PHP, it even has the function for you: get_headers()
nutkenz
Forum Contributor
Posts: 155
Joined: Tue Jul 19, 2005 12:25 pm

Post by nutkenz »

True, done.
Post Reply