You are here

function httprl_glue_url in HTTP Parallel Request & Threading Library 6

Same name and namespace in other branches
  1. 7 httprl.module \httprl_glue_url()

Alt to http_build_url().

Parameters

array $parsed: array from parse_url()

Return value

string URI is returned.

See also

http://php.net/parse-url#85963

1 call to httprl_glue_url()
httprl_parse_data in ./httprl.module
Extract the header and meta data from the http data stream.

File

./httprl.module, line 2649
HTTP Parallel Request Library module.

Code

function httprl_glue_url($parsed) {
  if (!is_array($parsed)) {
    return FALSE;
  }
  $uri = isset($parsed['scheme']) ? $parsed['scheme'] . ':' . (strtolower($parsed['scheme']) == 'mailto' ? '' : '//') : '';
  $uri .= isset($parsed['user']) ? $parsed['user'] . (isset($parsed['pass']) ? ':' . $parsed['pass'] : '') . '@' : '';
  $uri .= isset($parsed['host']) ? $parsed['host'] : '';
  $uri .= !empty($parsed['port']) ? ':' . $parsed['port'] : '';
  if (isset($parsed['path'])) {
    $uri .= substr($parsed['path'], 0, 1) == '/' ? $parsed['path'] : (!empty($uri) ? '/' : '') . $parsed['path'];
  }
  $uri .= isset($parsed['query']) ? '?' . $parsed['query'] : '';
  $uri .= isset($parsed['fragment']) ? '#' . $parsed['fragment'] : '';
  return $uri;
}