php cURL silent option?

http://php.net/manual/en/ref.curl.php

In recent versions of php, CURLOPT_MUTE has (probably) been deprecated. Any attempt of using curl_setopt() to set CURLOPT_MUTE will give you a warning like this:

PHP Notice: Use of undefined constant CURLOPT_MUTE - assumed 'CURLOPT_MUTE' in ....

If you wish to silence the curl output, use the following instead:

<?php
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
?>

And then,

<?php
    $curl_output=curl_exec($ch);
?>

The output of the curl operation will be stored as a string in $curl_output while the operation remains totally silent.


You want to set the CURLOPT_MUTE setting when initializing the connection:

curl_setopt($curl_resource, CURLOPT_MUTE, 1);

Looks like CURLOPT_MUTE has been deprecated in recent versions of php.

I'm using PHP 5.3.6 and I'm getting Use of undefined constant CURL_MUTE - assumed 'CURL_MUTE' whenever I try to set this option.

Tags:

Php

Curl