curl-library
Re: How to get CURLOPT_FOLLOWLOCATION to work?
Date: Thu, 17 Jul 2008 20:05:31 -0700
On Thu, Jul 17, 2008 at 08:10:48PM -0600, isaac_at_newcyberian.com wrote:
> 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?
libcurl only supports HTTP redirects; any other type needs to be determined
by the application. Any "generic" way will require not only parsing HTML
but running a JavaScript intepreter, too.
>>> Dan
-- http://www.MoveAnnouncer.com The web change of address service Let webmasters know that your web site has movedReceived on 2008-07-18