You are here

public function OAuthRequest::get_normalized_http_url in OAuth 1.0 7.3

Same name and namespace in other branches
  1. 6.3 lib/OAuth.php \OAuthRequest::get_normalized_http_url()
  2. 6 OAuth.php \OAuthRequest::get_normalized_http_url()

parses the url and rebuilds it to be scheme://host/path

2 calls to OAuthRequest::get_normalized_http_url()
OAuthRequest::get_signature_base_string in lib/OAuth.php
Returns the base string of this request
OAuthRequest::to_url in lib/OAuth.php
builds a url usable for a GET request

File

lib/OAuth.php, line 410
OAuth 1.0 server and client library.

Class

OAuthRequest

Code

public function get_normalized_http_url() {
  $parts = parse_url($this->http_url);
  $scheme = isset($parts['scheme']) ? $parts['scheme'] : 'http';
  $port = isset($parts['port']) ? $parts['port'] : ($scheme == 'https' ? '443' : '80');
  $host = isset($parts['host']) ? strtolower($parts['host']) : '';
  $path = isset($parts['path']) ? $parts['path'] : '';
  if ($scheme == 'https' && $port != '443' || $scheme == 'http' && $port != '80') {
    $host = "{$host}:{$port}";
  }
  return "{$scheme}://{$host}{$path}";
}