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

curl-and-php

Object Moved Error & Tricking the Server

From: Stephen Swift SA Business Affairs <sadba_at_geneseo.edu>
Date: Sat, 11 Dec 2004 01:08:50 -0500

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
Received on 2004-12-11