Deconstruct URI

3 weeks ago

nm777

Paste in a URI and see various components in a slightly more readable format.

Code

// Paste your URI here:
$uri = 'https://domain.com/some/path?conditions=company%2Fid%3D1234%20AND%20name%3D%22foobar%22&page=1&pageSize=10';

$query = [];

$parts = parse_url($uri);

parse_str($parts['query'], $query);

$parts['query'] = $query;

$parts;

Output

=> [
     "scheme" => "https",
     "host" => "domain.com",
     "path" => "/some/path",
     "query" => [
       "conditions" => "company/id=1234 AND name="foobar"",
       "page" => "1",
       "pageSize" => "10",
     ],
   ]