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

curl-and-php

RE: Curl-and-php Digest, Vol 11, Issue 4

From: Greg Bud <gbud_at_tarsus.co.uk>
Date: Sun, 12 Dec 2004 14:54:08 +0100

I have been having a similar problem and would appreciate any guidance
on this too.

Best regards
Greg

-----Original Message-----
From: curl-and-php-bounces_at_cool.haxx.se
[mailto:curl-and-php-bounces_at_cool.haxx.se] On Behalf Of
curl-and-php-request_at_cool.haxx.se
Sent: 11 December 2004 12:00
To: curl-and-php_at_cool.haxx.se
Subject: Curl-and-php Digest, Vol 11, Issue 4

Send Curl-and-php mailing list submissions to
        curl-and-php_at_cool.haxx.se

To subscribe or unsubscribe via the World Wide Web, visit
        http://cool.haxx.se/mailman/listinfo/curl-and-php
or, via email, send a message with subject or body 'help' to
        curl-and-php-request_at_cool.haxx.se

You can reach the person managing the list at
        curl-and-php-owner_at_cool.haxx.se

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Curl-and-php digest..."

Today's Topics:

   1. Object Moved Error & Tricking the Server
      (Stephen Swift SA Business Affairs)

----------------------------------------------------------------------

Message: 1
Date: Sat, 11 Dec 2004 01:08:50 -0500
From: Stephen Swift SA Business Affairs <sadba_at_geneseo.edu>
Subject: Object Moved Error & Tricking the Server
To: curl-and-php_at_cool.haxx.se
Message-ID: <20CDC77B-4B3B-11D9-9845-0005027792E7_at_geneseo.edu>
Content-Type: text/plain; charset=US-ASCII; format=flowed

Hello,
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. Can anyone help me avoid the Object Moved error?
Thanks. My code follows:

// create a new curl resource
$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL,
"http://ems.geneseo.edu/vems2/events.asp");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_MUTE, 1);
curl_setopt($ch,
CURLOPT_COOKIE,"ASPSESSIONIDQQQBBADB=CKCDKPDBCIALIIIEGCDJIKLG");
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_REFERER, "http://ems.geneseo.edu/vems2/");

// grab URL and pass it to the browser
$main = curl_exec($ch);

// close curl resource, and free up system resources
curl_close($ch);

Sincerely,

Stephen Swift
SA Dir. Business Affairs
sadba_at_geneseo.edu
585-245-5878
http://sa.geneseo.edu

--
The Student Association is funded by mandatory student activity fees.
Meetings: Every Wednesday, 6:15 pm in the College Union Hunt Room
------------------------------
_______________________________________________
Curl-and-php mailing list
Curl-and-php_at_cool.haxx.se
http://cool.haxx.se/mailman/listinfo/curl-and-php
End of Curl-and-php Digest, Vol 11, Issue 4
*******************************************
Received on 2004-12-12