1--TEST-- 2curl_setopt() call with CURLOPT_HTTPHEADER 3--CREDITS-- 4Paul Sohier 5#phptestfest utrecht 6--SKIPIF-- 7<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?> 8--FILE-- 9<?php 10 11$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER'); 12 13// start testing 14echo "*** curl_setopt() call with CURLOPT_HTTPHEADER\n"; 15 16$url = "{$host}/"; 17$ch = curl_init(); 18 19curl_setopt($ch, CURLOPT_HTTPHEADER, 1); 20 21$curl_content = curl_exec($ch); 22curl_close($ch); 23 24var_dump( $curl_content ); 25 26$ch = curl_init(); 27 28ob_start(); // start output buffering 29curl_setopt($ch, CURLOPT_HTTPHEADER, array()); 30curl_setopt($ch, CURLOPT_URL, $host); 31 32$curl_content = curl_exec($ch); 33ob_end_clean(); 34curl_close($ch); 35 36var_dump( $curl_content ); 37?> 38--EXPECTF-- 39*** curl_setopt() call with CURLOPT_HTTPHEADER 40 41Warning: curl_setopt(): You must pass either an object or an array with the CURLOPT_HTTPHEADER, CURLOPT_QUOTE, CURLOPT_HTTP200ALIASES and CURLOPT_POSTQUOTE arguments in %s on line %d 42bool(false) 43bool(true) 44