xref: /PHP-5.4/ext/curl/tests/curl_basic_013.phpt (revision 84b17658)
1--TEST--
2Test curl_opt() function with CURLOPT_HTTP_VERSION/CURL_HTTP_VERSION_1_1
3--CREDITS--
4TestFest 2009 - AFUP - Xavier Gorse <xgorse@elao.com>
5--SKIPIF--
6<?php if (!extension_loaded("curl") || false === getenv(b'PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
7--FILE--
8<?php
9/* Prototype  : bool curl_setopt(resource ch, int option, mixed value)
10 * Description: Set an option for a cURL transfer
11 * Source code: ext/curl/interface.c
12 * Alias to functions:
13 */
14
15  $host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
16
17  // start testing
18  echo '*** Testing curl with HTTP/1.1 ***' . "\n";
19
20  $url = "{$host}/get.php?test=httpversion";
21  $ch = curl_init();
22
23  ob_start(); // start output buffering
24  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
25  curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
26  curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
27
28  $curl_content = curl_exec($ch);
29  curl_close($ch);
30
31  var_dump( $curl_content );
32?>
33===DONE===
34--EXPECTF--
35*** Testing curl with HTTP/1.1 ***
36string(8) "HTTP/1.1"
37===DONE===
38