cURL Output? PHP

Status
Not open for further replies.

Mike

New member
Jun 27, 2006
6,777
116
0
51
On the firing line
I'd like to have cURL do it's business without outputting anything to the screen. How can this be done?

I know that:
Code:
curl_exec($ch);
is what sets it off. But then I get all this shit on my monitor that I don't want or need. I just want it to run silently then report when it's done.

Thanks.
 


I'm not an expert at this, but this is how I've done it. I always set a variable to the curl_exec like this:
HTML:
$data = curl_exec($ch); // execute the curl command
curl_close($ch); // close the connection
So then you can do whatever you want with $data because $data holds the page that you curled. As long as you don't echo out $data or something then it shouldn't show anything. If you wanted it to say completed or something just echo out "curl done" after the curl_close.

Is that what you were looking for?
 
you need to set this before calling curl_exec for it to return everything as a variable instead of spitting out to the screen:
HTML:
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
Status
Not open for further replies.