php url parameters code example
Example 1: get url with php
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
Example 2: php get
<form action="/" method="get">
<input type="text" name="name">
<br>
<input type="submit">
</form>
<?php
echo $_GET["query"];
?>
Example 3: Get Parameters From a URL String in PHP
phpCopy<?php
$url = "https://testurl.com/test/[email protected]&name=sarah";
$components = parse_url($url);
parse_str($components['query'], $results);
print_r($results);
?>
Example 4: Get Parameters From a URL String in PHP
phpCopy<?php
echo $_GET['email'] . $_GET['name']
?>
Example 5: Get Parameters From a URL String in PHP
phpCopy<?php
$url = "https://testurl.com/test/[email protected]&name=sarah";
$components = parse_url($url, PHP_URL_QUERY);
parse_str($components, $results);
print_r($results);
?>