Re: Limiting speed when using CURL functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, March 14, 2007 6:55 am, Tijnema ! wrote:
> On 3/12/07, Richard Lynch <ceo@xxxxxxxxx> wrote:
>> On Mon, March 12, 2007 7:14 am, Tijnema ! wrote:
>> > Is there any way i can limit the transfer speed when using CURL?
>> >
>> > I'm uploading a file to a server, and i don't want the script to
>> f***
>> > up all
>> > bandwidth.
>>
>> I don't recall ever seeing that in curl, but check on the curl site,
>> linked from here:
>> http://php.net/curl
> It's not on there, but i also contacted the CURL list, and they told
> me that libcurl (7.16) accepts the constants
> CURLOPT_MAX_SEND_SPEED_LARGE and CURLOPT_MAX_RECV_SPEED_LARGE, having
> the integer value of 145 and 146. In PHP those constants have not been
> defined (I check CVS, and it isn't there in PHP6). But even when using
> the integer values of those constants, it does not work. On the CURL
> list they can't help me really because they think it is a PHP problem.
>
> Tijnema
>
> ps. Installing PHP6 snapshot now to see if it differs.

I think you'll want to focus on upgrading the actual curl extension,
rather than PHP itself, which may or may not have newer curl bundled
into it...

PHP doesn't really *do* anything with 145/146 or their named
equivalents.  It just passes them into the low-level curl functions.

But if the curl library you have compiled in as the extension with PHP
is "older" than the one that introduced those constants, passing them
in won't do much, other than possible generate an error message or
even break it.

The only PHP-specific curl constant I'm aware of is
CURLOPT_BINARY_TRANSFER.

PS
If the newer functions are there, but not the constants, use something
like this:
if (!defined('CURLOPT_MAX_SEND_SPEED_LARGE')){
  define('CURLOPT_MAX_SEND_SPEED_LARGE', 145);
}
//and the same for RECV
so that your code won't need to change when you upgrade.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux