curl_setopt_array_basic.phpt [plain text]
--TEST--
curl_setopt_array() function - tests setting multiple cURL options with curl_setopt_array()
--CREDITS--
Mattijs Hoitink mattijshoitink@gmail.com
#Testfest Utrecht 2009
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
include 'server.inc';
$host = curl_cli_server_start();
if (!empty($host)) {
$url = "{$host}/get.php?test=get";
} else {
$tempname = tempnam(sys_get_temp_dir(), 'CURL_HANDLE');
$url = 'file://'. $tempname;
file_put_contents($tempname, "Hello World!\nHello World!");
}
echo '== Starting test curl_setopt_array($ch, $options); ==' . "\n";
$ch = curl_init();
$options = array (
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => 1
);
ob_start();
curl_setopt_array($ch, $options);
$returnContent = curl_exec($ch);
curl_close($ch);
var_dump($returnContent);
isset($tempname) and is_file($tempname) and @unlink($tempname);
?>
--EXPECT--
== Starting test curl_setopt_array($ch, $options); ==
string(25) "Hello World!
Hello World!"