cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Object Moved Error & Tricking the Server

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Sat, 11 Dec 2004 12:18:55 +0100 (CET)

On Sat, 11 Dec 2004, Stephen Swift SA Business Affairs wrote:

> I am trying to get the content from a certain webpage (events.asp).
> However, the page sends an Object Moved error and wants me to follow to
> another location (default.asp). I don't want that page. If I load the URL
> in my browser, it works fine. It seems to me that either the server is
> trying to prevent me from cURLing the page or I haven't provided it with
> enough data.

It sounds as if you're not providing the proper cookie.

> curl_setopt($ch,
> CURLOPT_COOKIE,"ASPSESSIONIDQQQBBADB=CKCDKPDBCIALIIIEGCDJIKLG");

I doubt this works. These kinds of session cookies are usually generated with
a session-specific value, so when you just repeat an old value you once had,
it won't have the desired effect. The server is bound to consider it illegal.

You probably first need to fetch the page that sets this cookie, then move on
you do this operation and use the cookie you just got.

LiveHTTPHeaders can reveal the answers to you.

> curl_setopt($ch,CURLOPT_FOLLOWLOCATION,0);

... and you probably still want to follow Location: headers, because it is
very likely that you'll just get a different one when you do everything right.

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-12-11