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
views:
69answers:
3so PHP_SELF + QUERY_STRING should do it?
kmunky
2009-11-07 02:55:12
IIRC, `$PHP_SELF` doesn't include the hostname - you'd want to add `$_SERVER['SERVER_NAME']` for that.
Amber
2009-11-07 03:24:22
Why don't you just use `$_SERVER['REQUEST_URI']`, as Zied suggested?
brianreavis
2009-11-07 05:16:39
+3
A:
A quick answer:
$url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
Zied
2009-11-07 02:36:52
+1
A:
$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'].$_SERVER['QUERY_STRING'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'].$_SERVER['QUERY_STRING'];
Xinus
2009-11-07 02:38:04