I read PHP Man about cURL, but don't see section mention to get data from a URL into a string variable. Can everybody show me the this code? Thank you very much
$ch = curl_init('http://example.com'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $content = curl_exec($ch); curl_close($ch); PHP:
@nico_swd: thank you very much, this code work good. Does is CURLOPT_RETURNTRANSFER determining factor? In PHP Man, I can't find section explain about these options, can you show me?
http://php.net/curl_setopt That manual topic describes all the options for curl, and yes in nico_swd's example CURLOPT_RETURNTRANSFER is the determining factor. I hope I've been of some help to you.
EDIT: Beat me to it. Without setting the returntransfer to true, curl_exec() will output the result, and you're not able to store it in a variable.