tags:

views:

685

answers:

1

How do i hide the output from curl in php? Or modify it?

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, PSSWDINFO);
    $result= curl_exec ($ch);
    curl_close ($ch);

The problem is that is spews out the entire page, how can i simply show a "success" or "failed" message.

+6  A: 

Use this option to curl_setopt():

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

This will make curl_exec return the data instead of outputting it.

To see if it was successful you can then check $result and also curl_error().

Greg
works great, thank you sir
Patrick