array HTTP2::parseLinks (
array|string $lines
)
Parses RFC 5988 ("Web Linking") HTTP link headers and splits each of the links up into an array you can then use further.
Usage example
<?php
require_once 'HTTP2.php';
//Link headers that we got from somewhere, e.g.
// HTTP_Request2_Response::getHeader('link')
$link = '<http://pear.php.net/webmention.php>; rel="webmention"';
$http = new HTTP2();
$links = $http->parseLinks($link);
var_dump($links);
?>
The script produces this output:
array(1) {
[0] =>
array(2) {
'_uri' =>
string(34) "http://pear.php.net/webmention.php"
'rel' =>
array(1) {
[0] =>
string(10) "webmention"
}
}
}
Note that a single link header may contain multiple links. For that reason, the method returns an array of link arrays.
array|string $lines -
A single Link: header value, or an array
of multiple Link: header values, without
the Link:.
array - Array of arrays.
Each array describes a link.
The URI is the key _uri,
all parameters have their names as keys.
The parameters title*,
rel and rev are multi-valued
and thus have an array as their value.
This function can not be called statically.