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

curl-and-php

Re: How to reset/unset cURL options?

From: Matthias <c.madmax_at_gmail.com>
Date: Mon, 04 Apr 2011 21:18:47 +0200

In other words there is no easy solution :(

Thank you anyway..

The problem with php-curl is, that it is absolute not up to date. cUrl
7.12.1 was released in Aug 2004, and nobody of the php developers has
implemented the new functions and options (except for a few). There are
many other examples.. CURLOPT_QUOTE and CURLOPT_POSTQUOTE are defined,
CURLOPT_PREQUOTE not... and so on..

Some more years waiting time and fiddle about :D

Am Montag, den 04.04.2011, 12:45 -0500 schrieb Michael Dowling:
> libcurl has a curl_easy_reset option that I think would remove all of
> these options that cannot be unset or removed indirectly by setting some
> other related option. The problem is that the PHP bindings do not
> currently implement this function. I recently opened a feature request
> on PHP.net for this issue:
>
> http://bugs.php.net/bug.php?id=54022
>
> You can often remove options from a curl handle by setting some other
> related option. For example, you can remove a lot of options from an
> HTTP based curl handle by setting CURLOPT_HTTPGET then setting your
> other method specific options. The best way to figure out how to
> indirectly unset curl options is to look at
> http://curl.haxx.se/libcurl/c/curl_easy_setopt.html
>
> I implemented a cURL handle manager in my cURL based PHP client library
> that will reuse curl handles for subsequent requests. It just throws
> away handles that it knows has options that cannot be unset. You might
> be able to extend this manager or implement something similar:
> https://github.com/guzzle/guzzle
> (https://github.com/guzzle/guzzle/blob/master/library/Guzzle/Http/Curl/CurlFactory.php).
> I had to implement my own cookie handling code because, like you said,
> CURLOPT_COOKIEJAR cannot be unset.
>
> -Michael
>
> On 4/4/11 10:53 AM, Matthias wrote:
> > Hello,
> >
> > how can i reset/unset curl options?
> >
> > if i set this option:
> >
> > curl_setopt($ch, CURLOPT_FTPPORT, NULL);
> >
> > php-curl send a PORT command to the ftp server, but i want to use PASV.
> >
> > Please don't answer i should not set this option to solve the problem,
> > because it is possible that i make multiple requests and reuse the curl
> > handle. What is if i want a PORT command in the first request, than
> > reuse the curl handle, and a PASV command in the second request?
> >
> > Why is there no CURLOPT_FTPPASV option ?
> >
> > I have the same problem with other options like CURLOPT_COOKIEJAR. It is
> > impossible to reset/unset this options for a second request :/
> >
> > NULL should reset/unset a option! Why does it not work?
> >
> >
> > _______________________________________________
> > http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2011-04-04