Informatie ophalen van website

Status
Niet open voor verdere reacties.

Rifero

Gebruiker
Lid geworden
14 mrt 2007
Berichten
13
Beste leden,

Ik heb een klein probleempje met het opvragen van informatie vanaf een site.

Dit is wat ik stuur naar de server:
GET /results/mp3/1/test HTTP/1.1
Accept: */*
Content-Type: application/x-www-form-urlencoded
Accept-Language: nl
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; AskTB5.6)
Host: 213.206.113.244
Connection: Keep-Alive
Content-Length:0
Cache-Control: no-cache


En dit is wat ik terugkrijg van de server:
HTTP/1.1 301 Moved Permanently
Date: Wed, 28 Apr 2010 00:18:51 GMT
Server: Apache/2.2.8 (Fedora)
Location: http://www.downloads.nl/results/mp3/1/test
Content-Length: 328
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://www.downloads.nl/results/mp3/1/test">here</a>.</p>
<hr>
<address>Apache/2.2.8 (Fedora) Server at downloads.nl Port 80</address>
</body></html>

Als ik handmatig (daarmee bedoel ik: via de browser) de informatie opvraag, is er geen probleem, dus de informatie die ik stuur is correct, alleen weet ik niet hoe ik moet reageren op een 301 error.
Wat is het volgende dat ik moet sturen om de informatie te kunnen krijgen?

Alvast hartelijk bedankt!
 
Laatst bewerkt:
De informatie staat op een nieuwe locatie. Om de info op te halen is een tweede request met de nieuwe URI nodig.
Deze URI is te vinden in het veld "Location".
Dat is in dit geval "http://www.downloads.nl/results/mp3/1/test"

Citaat van de HTTP 1.1 specificatie (RFC 2616)
10.3.2 301 Moved Permanently

The requested resource has been assigned a new permanent URI and any
future references to this resource SHOULD use one of the returned
URIs. Clients with link editing capabilities ought to automatically
re-link references to the Request-URI to one or more of the new
references returned by the server, where possible. This response is
cacheable unless indicated otherwise.

The new permanent 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 301 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.

Note: When automatically redirecting a POST request after
receiving a 301 status code, some existing HTTP/1.0 user agents
will erroneously change it into a GET request.
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan