Hosting Solutions
mobile_logo Table of Contents

GeoPlugin Tutorial Get User Location Information IP Detection

Learn to use the GeoPlugin within your PHP scripts. GeoPlugin returns an array that you can easily parse using PHP. Detecting user location automatically according to their IP address requires that we have access to a geoip database to refer to in our programs. GeoPlugin offers that to you remotely which makes the set up of GEOIP programs much simpler and faster. example.php <?php $user_ip = getenv('REMOTE_ADDR'); $geo = unserialize(file_get_contents("$user_ip")); $city = $geo["geoplugin_city"]; $region = $geo["geoplugin_regionName"]; $country = $geo["geoplugin_countryName"]; echo "City: ".$city."<br>"; echo "Region: ".$region."<br>"; echo "Country: ".$country."<br>"; /* geoplugin_request geoplugin_status geoplugin_credit geoplugin_city geoplugin_region geoplugin_areaCode geoplugin_dmaCode geoplugin_countryCode geoplugin_countryName geoplugin_continentCode geoplugin_latitude geoplugin_longitude geoplugin_regionCode geoplugin_regionName geoplugin_currencyCode geoplugin_currencySymbol geoplugin_currencySymbol_UTF8 geoplugin_currencyConverter */ ?>

PHP Videos


Website Design Theme Application PHP Cookies CSS TutorialPDO Prepared Statements PHP TutorialPDO Tutorial Connect Database and Query ExampleActive Page Link Button Highlight TutorialGeoPlugin Tutorial Get User Location Information IP DetectionHashtag System and Regex PHP Programming TutorialPagination MySQLi Google Style Paged Results TutorialActive Clickable Link Function preg_replace Programming TutorialGet Favicon From Web Site Link Access External FilesRandom String Generator PHP Function Programming TutorialForce File Download Dialog In Browser TutorialCheck User Sign Up Name Ajax PHP Social Network TutorialFlat File Text Database System CMS Edit Content TutorialFlat File Text Database System Display ContentExperience Level Evaluation Programming TutorialStagger and Limit Dynamic Output in a While Loop Google AdsTwitter Dynamic Goodies Widget TutorialDynamic Google Maps Location TutorialPrepared Statements PHP mysqli Tutorial