About
Web - URL in php
Parse
The query part
URL - Query String in php
You parse it in two steps:
- first the string format of the query part with parse_url
$parsedQuery = parse_url($url,PHP_URL_QUERY);
- then you put the key/argument of the query in an array with parse_str. This function takes care of the fact that string may be URL encoded
$parsedQueryArray = [];
parse_str($parsedQuery,$parsedQueryArray);
- then get the property value
$propertyValue = $parsedQueryArray['propertyName']