mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/11603] Fix spacing and add some comments
PHPBB3-11603
This commit is contained in:
parent
e4ccc5e6ea
commit
92c55ab111
1 changed files with 5 additions and 2 deletions
|
@ -156,17 +156,19 @@ function api_request($query, $full_url = false)
|
|||
}
|
||||
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($c, CURLOPT_USERAGENT, 'phpBB/1.0');
|
||||
curl_setopt($c, CURLOPT_HEADER, true);
|
||||
curl_setopt($c, CURLOPT_HEADER, true);
|
||||
$contents = curl_exec($c);
|
||||
curl_close($c);
|
||||
|
||||
$sub_request_result = array();
|
||||
// Split possible headers from the body
|
||||
if ($contents && strpos($contents, "\r\n\r\n") > 0)
|
||||
{
|
||||
list($header, $contents) = explode("\r\n\r\n", $contents);
|
||||
foreach (explode("\n", $header) as $header_element)
|
||||
{
|
||||
if (strpos($header_element, 'Link') === 0)
|
||||
// Find Link Header which gives us a link to the next page
|
||||
if (strpos($header_element, 'Link: ') === 0)
|
||||
{
|
||||
list($head, $header_content) = explode(': ', $header_element);
|
||||
foreach (explode(', ', $header_content) as $links)
|
||||
|
@ -174,6 +176,7 @@ function api_request($query, $full_url = false)
|
|||
list($url, $rel) = explode('; ', $links);
|
||||
if ($rel == 'rel="next"')
|
||||
{
|
||||
// Found a next link, follow it and merge the results
|
||||
$sub_request_result = api_request(substr($url, 1, -1), true);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue