note 88055 modified in curl.examples-basic by rquadling
| From: | rquadling@php.net | Date: | Mon, 09 May 2011 13:10:52 +0000 |
| Subject: | note 88055 modified in curl.examples-basic by rquadling | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179562@lists.php.net to get a copy of this message | ||
Following code returns the curl output as a string.
<?php
// create curl resource
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, "example.com");
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$output = curl_exec($ch);
// close curl resource to free up system resources
curl_close($ch);
?>
--was--
Following code returns the curl output as a string.
<?php
// create curl resource
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, "example.com");
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$output = curl_exec($ch);
// close curl resource to free up system resources
curl_close($ch);
?>
http://php.net/manual/en/curl.examples-basic.php