<?php function curPageURL() { $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; } ?> <?php echo curPageURL(); ?>
Wednesday, 14 August 2013
How to Get the Current Page URL
How to check if the request came from mobile or computer using php
Include Mobile_Detect.php file Download from Here
<?php require_once ('Mobile_Detect.php'); $detect = new Mobile_Detect; $deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer'); $scriptVersion = $detect->getScriptVersion(); ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"> </head> <body> <p>This is a <b><?php echo $deviceType; ?></b></p> </body> </html>
Subscribe to:
Posts (Atom)