How do I hide the output from curl in PHP?
My code as it stands is the following:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERPWD, $pass);
$result = curl_exec($ch);
curl_close ($ch);
The problem is that is spews out the entire page to the user. Instead I want to capture the output and simply show a "success" or "failed" message?
Use this option to
curl_setopt():This will make
curl_execreturn the data instead of outputting it.To see if it was successful you can then check
$resultand alsocurl_error().