Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable PHP's exec function for printing to the shell?

Tags:

php

exec

I have the following php code:

exec('curl -X POST http://mysite.com', $output =array());

The return string my http://mysite.com is not displayed on the shell, but the following string is displayed:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     3    0     3    0     0     19      0 --:--:-- --:--:-- --:--:--     0

I don't want anything to display on the shell. How to I disable priting to the shell when using exec() command. There are other commands?

like image 532
Cory Avatar asked Dec 16 '22 22:12

Cory


1 Answers

Use curl's silent option: -s

exec('curl -s http://us.php.net/manual/en/function.ob-clean.php', $output);
like image 65
KeatsKelleher Avatar answered Mar 18 '23 05:03

KeatsKelleher