message
[mdref/mdref-http] / http / Message / setHttpVersion.md
1 # http\Message http\Message::setHttpVersion(string $http_version)
2
3 Set the HTTP protocol version of the message.
4 See http\Message::getHttpVersion().
5
6 ## Params:
7
8 * string $http_version
9 The protocol version, e.g. "1.1", optionally prefixed by "HTTP/".
10
11 ## Returns:
12
13 * http\Message, self.
14
15 ## Notices:
16
17 * E_MALFORMED_HEADERS, if the version separator is non-standard.
18
19 ## Warnings:
20
21 * E_MALFORMED_HEADERS, if the version could not be parsed.
22
23 ## Example:
24
25 <?php
26 $message = new http\Message;
27 var_dump($message->getHttpVersion());
28 $message->setHttpVersion("HTTP/1_0");
29 var_dump($message->getHttpVersion());
30 ?>
31
32 Yields:
33
34 string(3) "1.1"
35 Notice: Non-standard version separator '_' in HTTP protocol version 'HTTP/1_0'
36 string(3) "1.0"