JavaでIPアドレスから都市名を知ることは可能ですか?
17789 次
3 に答える
4
あなたはjspまたは何を使用していますか?クライアント側の都市名の場合、Google の API を使用して、IP でマッピングされたユーザーの地理的な詳細を返すことができます。Googleのドキュメントによると、次のものを取得できます
データが入力されると、google.loader.ClientLocation オブジェクトには次の大都市レベルの粒度プロパティが入力されます。
* ClientLocation.latitude — supplies the low resolution latitude associated with the client's IP address
* ClientLocation.longitude — supplies the low resolution longitude associated with the client's IP address
* ClientLocation.address.city — supplies the name of the city associated with the client's IP address
* ClientLocation.address.country — supplies the name of the country associated with the client's IP address
* ClientLocation.address.country_code — supplies the name of the ISO 3166-1 country code associated with the client's IP address
* ClientLocation.address.region — supplies the country specific region name associated with the client's IP address
詳細については、 http://code.google.com/apis/ajax/documentation/にある完全なドキュメントを参照してください。
于 2010-02-13T11:16:44.510 に答える
2
IP を物理的な場所にマップするhostip.infoなどのサービスを使用し、開発者にAPIを提供してタスクを簡素化する必要があります。
Googleには、有料および無料のサービスが他にも多数あります。
于 2010-02-13T10:30:15.837 に答える
1
他の人が提案したオンライン API があなたのアプリケーションに合わない場合、私は以前にMaxMind GeoLite Cityを使用して成功しました。データベース ファイルをダウンロードし、API コードを指定するだけですぐに使用できます。シンプルでわかりやすい。
于 2010-02-14T05:42:09.380 に答える