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

curl-and-php

Re: Workaround URL Fragment (anchor) following redirect ?

From: Stephen Pynenburg <spynenburg_at_gmail.com>
Date: Mon, 6 Jul 2009 13:45:44 -0400

Hi,
  There is no callback function that changes headers on-the-fly, as you
would have to wait for the request to be over to do so anyway. I think your
best option is to get the headers for each handle you have (using
CURLOPT_NOBODY), checking to see if the redirect URL has the HTML anchor,
and then doing the full requests to the redir-urls on a second pass through,
with the corrections.

Of course, whether this makes sense depends on a) How often a URL with this
problem turns up, and b) How critical time taken is in your application. If
this solution is no good, I guess your only other option is to rebuild cURL
on your server and patch the backend yourself. (assuming you know some C).
-Stephen

On Mon, Jul 6, 2009 at 06:25, Martin Konradi <martin_at_konradi.de> wrote:

>
> Dear List,
>
> I'm getting 404 errors if I use CURLOPT_FOLLOWLOCATION and the
> "anchor-part" #xyz remains in the url as described in:
>
> http://curl.haxx.se/mail/lib-2009-04/0259.html
>
> Is there a workaround for php like a callback-funktion to rewrite the
> header-redirect when using curl_multi_exec() ?
>
> Thanks a lot!
>
> martin
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2009-07-06