|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-12-19 04:30 UTC] paul at rydell dot com
I would like to use cURL to read the HTML (or whatever I am fetching) directly into a variable instead of only into a file or STDOUT.
Something like:
$ch = curl_init("http://www.somepage.com/");
curl_setopt($ch,CURLOPT_VARIABLE,$myoutput);
curl_exec($ch);
print $myoutput;
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Mon Jun 15 18:00:01 2026 UTC |
There is already CURLOPT_RETURNTRANSFER option which can be used to to this. <?php $ch = curl_init("http://www.somepage.com"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $myoutput=curl_exec($ch); curl_close($ch); ?> There was a bug with CURLOPT_RETURNTRANSFER but it's now fixed in CVS. --Jani