cURL / PHP Question - How to stop output to browser?

I have a PHP script setup using cURL to SEND POST DATA to a remote form. Now the problem is after it sends the data, it also follows the POST url so that I get the page I’m POSTing to put out into my browser.

How do I stop this and simply, say, just echo a message ‘done’ or something along those lines?

Small tweak there :wink: When using curl, the default setup is so that once the send is done, it outputs the results to the page. Add the following line before your curl_exec, this tells curl to return the page in the form of a variable, which is returned when you run the statement curl_exec. :slight_smile:

curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

Actually if you dont want to store it in a string, just not show it then:


 curl_setopt($ch, CURLOPT_NOBODY,1);

Silly