cURL / Mailing Lists / curl-library / Single Mail

curl-library

Doubling download speed?

From: <mail_at_sahneschuessel.com>
Date: Fri, 1 May 2009 13:43:07 -0700 (PDT)

Hi there

I just succeeded in doubling the speed of downloading the page http://www.nzz.ch/ by loading header and body in two steps instead of one. That means, I changed

  $curl = curl_init();
  curl_setopt ($curl, CURLOPT_URL, $url1);
  curl_setopt ($curl, CURLOPT_HEADER, 1);
  curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt ($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Linux 2.6)");
  $res = curl_exec($curl);
  curl_close($curl);
  echo $res;

into

  $curl = curl_init();
  curl_setopt ($curl, CURLOPT_URL, $url1);
  curl_setopt ($curl, CURLOPT_HEADER, 1);
  curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt ($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Linux 2.6)");
  curl_setopt ($curl, CURLOPT_NOBODY, 1);
  $res1 = curl_exec($curl);
  curl_setopt ($curl, CURLOPT_HEADER, 0);
  curl_setopt ($curl, CURLOPT_NOBODY, 0);
  $res2 = curl_exec($curl);
  curl_close($curl);
  echo $res1.$res2;

The cURL info under php 4.3.11 is libcurl/7.12.0 OpenSSL/0.9.6g zlib/1.1.3.

It might be that my question is totally stupid, but anyways: do you have an idea why this could happen? Many thanks!

Best regards
bac
Received on 2009-05-01