Sponsored Content
Top Forums Shell Programming and Scripting how to detect ip address based location using PHP Post 302219093 by siftin-com on Monday 28th of July 2008 04:43:29 AM
Old 07-28-2008
how to detect ip address based location using PHP

I am interested in finding out if there is a reliable and economical way for extracting user's location based on his ip address, using php

I tried to get the job done using ip2location.com, but I am not happy how it deals with result inconsistently.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

copying files from one location to another based on a list

I have a text list of about 3,000 file names (image files), which exist on a server and that I want to copy over to another location. I understand the Unix cp code, but what's the string to have it copy multiple files based on an external list? Many thanks! (4 Replies)
Discussion started by: rebornhonest
4 Replies

2. Shell Programming and Scripting

Need your HELP:: Shell script to detect paragraph in coordinate-based code.

Hi Friends!! I have obtained following output from a tool called pdftoxml: <xml> <text top="423" left="521" width="333" height="20" font="3">Although the the number of fuzzy rules of a system is </text> <text top="441" left="500" width="355" height="20" font="3">directly dependant on these... (2 Replies)
Discussion started by: parshant_bvcoe
2 Replies

3. UNIX for Advanced & Expert Users

detect mac address modication in linux

Hi, How Detect the mac address modification of a machine...in linux Thanks (1 Reply)
Discussion started by: shivarajM
1 Replies

4. AIX

Hardware address to physical location

Hello How do I deternine the physical location of an ethernet port, based on the hardware address? I have 4 ports on a 9133-55A ent0 05-08 ent1 05-09 ent2 07-08 ent3 07-09 Two of these are internal, and two are on a card. I need to single out ent0 and ent2, but I cannot find any... (4 Replies)
Discussion started by: mhenryj
4 Replies

5. UNIX for Dummies Questions & Answers

How to detect ip address from last reboot done?

Hi How would i detect the ip address from where the reboot command been given to linux host. My linux host details are as below. # lsb_release -a LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch Distributor ID: EnterpriseEnterpriseServer Description: ... (1 Reply)
Discussion started by: pinga123
1 Replies

6. Web Development

HTML/PHP show IMG based on location

HI guys/gals, I like to add some personal touches to a welcome image on our mediawiki site, and have the welcome be displayed in the, presumed, language of the visitor. Standard would be English, but if the IP or browser or OS is set to be in India, I want to display the message in Urdu for... (5 Replies)
Discussion started by: lawstudent
5 Replies

7. Web Development

PHP client location based page loading

Hi, I am new to PHP and at first got a task where I need some clues and help. So I am here.. The server is build to provide customized access for modules as per location. If client location is US then it shows modules and pages specific to US and if location is UK then it shows UK specific... (1 Reply)
Discussion started by: zing_foru
1 Replies

8. Shell Programming and Scripting

Parse based on location

I do have a big text file >A1 ACFGTSDCHG_GDF DGHA >A2 A_FGGSD_HG_GSF DGTA >A3 AC_GSDD_TU_GDF DGH_ .. ... there are equal number of characters within all the sub-headers. I want to parse out all the characters under each sub-header from user specified locations. For example, I want... (5 Replies)
Discussion started by: Lucky Ali
5 Replies

9. IP Networking

Where to find IP address to location data?

I'm trying to remotely probe a range of IP addresses. First I need a list of IP addresses for a very small geographic area. I've had a lot of trouble obtaining them. I would like to find a database or something. Suppose I do get the data. Can I see if that IP address is in use by someone? Can I... (2 Replies)
Discussion started by: rockandAir
2 Replies

10. UNIX for Advanced & Expert Users

C program to detect duplicate ip address if any after assigning ip address to ethernet interface

Hi , Could someone let me know how to detect duplicate ip address after assigning ip address to ethernet interface using c program (3 Replies)
Discussion started by: Gopi Krishna P
3 Replies
IP2LONG(3)								 1								IP2LONG(3)

ip2long - Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address

SYNOPSIS
int ip2long (string $ip_address) DESCRIPTION
The function ip2long(3) generates an IPv4 Internet network address from its Internet standard format (dotted string) representation. ip2long(3) will also work with non-complete IP addresses. Read http://publibn.boul- der.ibm.com/doc_link/en_US/a_doc_lib/libs/commtrf2/inet_addr.htm for more info. PARAMETERS
o $ip_address - A standard format address. RETURN VALUES
Returns the IPv4 address or FALSE if $ip_address is invalid. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ |5.2.10 | | | | | | | Prior to this version, ip2long(3) would some- | | | times return a valid number even if passed an | | | value which was not an (IPv4) Internet Protocol | | | dotted address. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 ip2long(3) Example <?php $ip = gethostbyname('www.example.com'); $out = "The following URLs are equivalent:<br /> "; $out .= 'http://www.example.com/, http://' . $ip . '/, and http://' . sprintf("%u", ip2long($ip)) . "/<br /> "; echo $out; ?> Example #2 Displaying an IP address This second example shows how to print a converted address with the printf(3) function in both PHP 4 and PHP 5: <?php $ip = gethostbyname('www.example.com'); $long = ip2long($ip); if ($long == -1 || $long === FALSE) { echo 'Invalid IP, please try again'; } else { echo $ip . " "; // 192.0.34.166 echo $long . " "; // -1073732954 printf("%u ", ip2long($ip)); // 3221234342 } ?> NOTES
Note Because PHP's integer type is signed, and many IP addresses will result in negative integers on 32-bit architectures, you need to use the "%u" formatter of sprintf(3) or printf(3) to get the string representation of the unsigned IP address. Note ip2long(3) will return FALSE for the IP 255.255.255.255 in PHP 5 <= 5.0.2. It was fixed in PHP 5.0.3 where it returns -1 (same as PHP 4). SEE ALSO
long2ip(3), sprintf(3). PHP Documentation Group IP2LONG(3)
All times are GMT -4. The time now is 09:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy