일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
- 자바스크립트
- 공모주 청약
- 6월 공모주 청약 일정
- css
- 공모주 청약 일정
- 오라클
- Stock ipo
- SQL
- 자바
- 맥
- php
- html
- 코드이그나이터
- IPO
- JavaScript
- 주식 청약
- 공모주
- jquery
- Stock
- java
- Eclipse
- Oracle
- linux
- 주식
- codeigniter
- 7월 공모주 청약 일정
- MYSQL
- 리눅스
- 주식 청약 일정
- 제이쿼리
- Today
- Total
개발자의 끄적끄적
[php/codeigniter] geoip library [펌] 본문
[php/codeigniter] geoip library [펌]
잘정리되어 있는 geoip 라이브러리가 있어서
참고용으로 퍼왔습니다!!
개발하실때 참고들 하세요!!
출처는 아래 명시했습니다!
Geolocalization IP Online
Geolocalizacion mediante ip, utilizando la api de http://www.ipinfodb.com/, de manera online, sin base de datos locales. Sencilla libreria para el framework de php Codeigniter 3.0.
Simple library for CodeIgniter framework 3.0 to locate ip by online without locals database, http://www.ipinfodb.com/ APIs.
##Instructions:
1
Primero debes crearte una cuenta gratis en http://www.ipinfodb.com/ y obtener una clave y cambiar el valor de $_key en la clase (application/libraries/Geoip), puedes usar una clave que he generado yo por ti, pero no aseguro que funcione siempre.
You must first create an free account in http://www.ipinfodb.com/ and obtain a key and change the value of $_key in the class (application/libraries/Geoip), you can use a key generated by me, but I not assure that work for ever.
2
Debes agregar el archivo GeoIP.php en la carpeta application/libraries
You most add the file GeoIP.php in the folder application/libraries
3
Load the library, in your controller, model...
$this->load->library('geoip');
4
LLame al metodo geolocalization e ingresa una IP o nada, en su defecto se carga: $this->CI->input->ip_address()
Call method geolocalization and enter an IP Address or null,default load: $this->CI->input->ip_address()
$this->geoip->geolocalization("181.110.XXX.XXX");
5 Done!
Una vez cargado puedes obtener los detalles de geo localizacion del usuario mediante su IP.
Once loaded you can get user's geo location details by IP address.
echo $this->geoip->info->countryName; //return Argentina
echo $this->geoip->info->cityName; //return Buenos Aires
RETURNED DATA JSON OBJECT
{
"statusCode" : "OK",
"statusMessage" : "",
"ipAddress" : "181.110.XXX.XXX",
"countryCode" : "AR",
"countryName" : "Argentina",
"regionName" : "Distrito Federal",
"cityName" : "Buenos Aires",
"zipCode" : "1871",
"latitude" : "35.6552",
"longitude" : "-31.57*2",
"timeZone" : "-03:00"
}
No es muy recomendable utilizar la api si se necesita una buena performance ya que es lenta, preferentemente llamar al metodo geolocalization a lo ultimo.
It is highly recommended to use the api if you want a good performance, preferably use the method geolocalization at last.
Desarrollado por: Ariel Marti
'개발 > php' 카테고리의 다른 글
[php] CROSS DOMAIN 대응 방법 (0) | 2020.06.29 |
---|---|
[PHP] 강좌 #12 조건문 switch case문 (0) | 2020.06.24 |
[php] 현재 url 확인 (0) | 2020.06.22 |
[PHP]인젝션 공격 방어 대책 (0) | 2020.06.18 |
[php] php에서 hash table DoS(HashDoS) 공격 방어 [펌] (0) | 2020.06.18 |