Calling a webpage with Curl: Moved Permanently

0

I tried to retrieve an HTTP response from a URL on port 8080 by using Curl.

When I type the URL in my browser and inspect the response with a proxy (ZAP here) everything is good => code 200.

When I use curl like this:

curl -b "cookie_name=cookie_value" http://url:8080/some_directory

I get this response:

<!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://url:8080/some_directory">here</a>.</p>
<hr>
<address>Apache/2.4.9 (Win32) PHP/5.5.12 Server at some_ip Port 8080</address>
</body></html>

Why do I get a different response from the server ?

p.s: the page I'm accessing required to be identified as a user on the website

Stephane

Posted 2016-09-03T20:04:10.100

Reputation: 21

Have you examined the cookie? Is the URL in the cookie the same as the URL you are using in your curl call? (For example, one could be for site.web and the other for www.site.web or a numeric IP address.) – AFH – 2016-09-03T20:27:51.967

@AFH Yes the cookie is the same – Stephane – 2016-09-04T09:43:36.953

No answers