php get from url code example
Example 1: php get url with get
$full_url = 'http://'.$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI];
Example 2: get page url php
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
Example 3: get url with php
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
Example 4: php get
<form action="/" method="get">
<input type="text" name="name">
<br>
<input type="submit">
</form>
<?php
echo $_GET["query"];
?>
Example 5: php get data from url
// previous link
<a href="test_get.php?subject=PHP&web=W3schools.com">Test $GET</a>
// the code
<?php
echo "Study " . $_GET['subject'] . " at " . $_GET['web'];
?>