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