3

I have a PHP script which connects to a remote server with cURL and download some files. I run it thru the command line,

php get.php

Whenever it starts downloading data, I get this output:

Total    % Received % Xferd  Average Speed   Tim Dload  Upload   Total   Spent    Left  Speed
100      162k       0        162k            0   0      21732    0       --:--:-- 0:00:07 --:--:-- 36001

How do I disable it?

NDM
  • 6,731
  • 3
  • 39
  • 52
Roger W.
  • 327
  • 1
  • 4
  • 15

1 Answers1

6

From the manual refering to CURLOPT_NOPROGRESS:

CURLOPT_NOPROGRESS

TRUE to disable the progress meter for cURL transfers.

Note: PHP automatically sets this option to TRUE, this should only be changed for debugging purposes.

Looks like the progress has been explicitly turned on. Check your code for that option. In any case, if you want to explicitly disable it again, curl_setopt($curlHandle, CURLOPT_NOPROGRESS, true) should do the trick.

Update: If you instead do something like exec("curl http://example.com") you should a) think about what you're doing and b) run curl -s to disable the progress. PHP's streams have support for http, so you can just use file_get_contents, copy et al.

Peter
  • 29,454
  • 5
  • 48
  • 60