Reputation: 15613
How can I get the full URL, like http://www.domain.com/page.php?id=someid&page=1
, not just http://www.domain.com/page.php
?
Upvotes: 0
Views: 280
Reputation: 1716
A quick answer:
$url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
Upvotes: 3
Reputation: 30563
$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'].$_SERVER['QUERY_STRING'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'].$_SERVER['QUERY_STRING'];
Upvotes: 1