Every php coder ask questions to get CURRENT PAGE URL with PHP, it is not as straightforward in raw php coding as one may think to get the current url to use it inside your application. Here is a code which you can use to get url easily.
function CPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; }
Replace the use of $_SERVER[“SERVER_NAME”] variable by $_SERVER[“HTTP_HOST”]
IF you use a shared server hosting this cause problems
🙂
Do you have a tutorial on $curl>
cause i am very much interested on this topics..by the way this site is so cool .. A site for programmers..Great work
Thanks for appreciation, let me know if anything specific you need in php.
Nice tutorial i learned a lot thanks keep up the good work.