使用 curlto send POST 请求总是输出结果

using curlto send POST request always outputs the result

我正在使用 curl 发送端口请求,而不使用此代码打印结果

$data = array('username' => 'username', 'password' => 'password');
$url = 'http://urlhere';
$ch = curl_init($url);
$postString = http_build_query($data, '', '&');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
// or use this line curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

我在最后一行代码中使用了 1 和 true,但它总是在网页上打印结果。如何在不输出结果的情况下执行curl?

必须工作,因为我在我的日常项目中使用相同的代码并在不打印的情况下取回数据

            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);