Php - URL

About

Web - URL in php

Parse

The query part

URL - Query String in php

You parse it in two steps:

$parsedQuery = parse_url($url,PHP_URL_QUERY);
  • then you put the key/argument of the query in an array with parse_str. <note info>This function takes care of the fact that string may be URL encoded</note>
$parsedQueryArray = [];
parse_str($parsedQuery,$parsedQueryArray);
  • then get the property value
$propertyValue = $parsedQueryArray['propertyName']

Powered by ComboStrap