xref: /PHP-5.6/ext/curl/tests/curl_basic_013.phpt (revision c507c9f0)
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 include 'skipif.inc'; ?>
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  include 'server.inc';
16  $host = curl_cli_server_start();
17
18  // start testing
19  echo '*** Testing curl with HTTP/1.1 ***' . "\n";
20
21  $url = "{$host}/get.php?test=httpversion";
22  $ch = curl_init();
23
24  ob_start(); // start output buffering
25  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
26  curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
27  curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
28
29  $curl_content = curl_exec($ch);
30  curl_close($ch);
31
32  var_dump( $curl_content );
33?>
34===DONE===
35--EXPECTF--
36*** Testing curl with HTTP/1.1 ***
37string(8) "HTTP/1.1"
38===DONE===
39