cURL / Mailing Lists / curl-library / Single Mail

curl-library

How to get CURLOPT_FOLLOWLOCATION to work?

From: <isaac_at_newcyberian.com>
Date: Thu, 17 Jul 2008 20:10:48 -0600 (MDT)

In my c++ code I had set

curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);

But when I retrieved sites with redirect my buffer string still had the
pre-directed html. For example,

http://www.microsoft.com/BillGates/ is redirected to
http://www.microsoft.com/presspass/exec/billg/bio.mspx, yet the content of
my buffer string was

<html>
<head>
<meta name="robots" content="noindex" />
<meta http-equiv=refresh content="0;URL=/presspass/exec/billg/bio.mspx">
<title>File has moved</title>
</head>
.....

I looked into the header with CURLOPT_WRITEHEADER and I got
HTTP/1.1 200 OK.

I know there are many ways to render redirect. Is there a generic way to
detect redirect and get the final destination URL?
Received on 2008-07-18