note 88055 modified in curl.examples-basic by danbrown
| From: | danbrown@php.net | Date: | Wed, 07 Jan 2009 23:58:15 +0000 |
| Subject: | note 88055 modified in curl.examples-basic by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-148934@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.
<?
// 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