I am trying to write a script that you input a phone number, and it outputs the address and name the number is listed under. How do i do this? Please help me. I will be very grateful.

Hi,

First you would need to find some kind of database full of numbers and there addresses - not sure where you could find this.

You would then need to cross-reference this information (which is easy). Just add the info into a database with the phone number(s), address, name, etc. and search it when the number is given.

I'm not sure if there is any other way to do this, but it may require a lot of work (in some places).

Kieran :)

Hi,

First you would need to find some kind of database full of numbers and there addresses - not sure where you could find this.

You would then need to cross-reference this information (which is easy). Just add the info into a database with the phone number(s), address, name, etc. and search it when the number is given.

I'm not sure if there is any other way to do this, but it may require a lot of work (in some places).

EDIT: You would also need to find databases for different countries (depending on what you will support). For the US, I wouldn't be surprised if the databases where split into states or provider, and the same in the UK. Well, for the UK you could just use the yellow pages (yell.com or something).

Kieran :)

Do you know where i could find a database like that? and how would i cross referance that?

Opps, wasn't supposed to post 2, only supposed to edit :(

I am looking on Google...

UK:
The website www.thephonebook.bt.com should help

US:
Maybe http://www.whitepages.com/
That seems to have a reverse phone number thing, so you *could* query that, but they might block you.

You would need to add the info into a database in the structure like this [for MySQL]:

id | phone_number | address  | name
01 | 00000 000000 | Example  | Kieran
02 | 00000 000000 | Example2 | Someone else

Then you just need to query it for the phone number:

$query = sprintf("SELECT * FROM phone_numbers WHERE `phone_number`='%s'", $phoneNumber);

mysql_query($query);

There are other ways to search a MySQL database, that just the easiest.

Kieran :)

P.S. I will try to help if there are any more questions ;)

how could i query it from white pages?

how could i query it from white pages?

Ok, It seems to be a complex site (which is bad).

I can't find any downloadable database (yet) and white pages is complex (because of how its made).

To query it (using a URL) use: http://www.whitepages.com/search/ReversePhone?full_phone=PHONE_NUMBER_HERE

I can't help on extracting the information though, never done it before tbh

I think, to do this, you would need to find an actual database where you can see ALL of the data without search terms etc. Something like this is likely to cost, a lot.

Kieran :)

Member Avatar for diafol

These are the sorts of DBs that are created, bought and sold for a lot of money. You also have to be careful with DBs that you 'find'. Are you allowed to distribute this data without permission? I'm ex-directory, but I get pestered by people who have no right to know my details. When I challenge them with wanting to know how they got my personal details, they hang up. If my personal details were to be found in a website, I'd be absolutely furious.

These are the sorts of DBs that are created, bought and sold for a lot of money. You also have to be careful with DBs that you 'find'. Are you allowed to distribute this data without permission? I'm ex-directory, but I get pestered by people who have no right to know my details. When I challenge them with wanting to know how they got my personal details, they hang up. If my personal details were to be found in a website, I'd be absolutely furious.

I can understand that, I don't use a land line anymore - only a mobile + Skype (with a number). If your number used to be in the phone directory(s) then it may have been archived somewhere (just a thought). I think you really need to think "Is what I'm doing legal and right?". And this is when the debates come in... Some people that it should be allowed, but I'm sure the majority don't agree with archiving/storing peoples phone numbers.

Just an afterthought...

Kieran :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.