Perlkonig / grav-plugin-iplocate

Grav plugin for geolocating visitors
https://www.perlkonig.com/demos/iplocate
MIT License
8 stars 4 forks source link

The plugin don't work #6

Closed andreaschiona closed 7 years ago

andreaschiona commented 7 years ago

I've tryed the plugin but I don't see any data.

---
title: 'Plugin Demo: ipLocate'
published: true
visible: true
summary:
    enabled: true
    format: short
    size: 128
taxonomy:
    category:
        - ''
    tag:
        - GravDemo
author: aaron
metadata:
    author: aaron
cache_enable: false
twig_first: true
process:
    twig: true
fields:
    - areaCode
    - city
    - continentCode
    - continentName
    - countryCode
    - countryName
    - currencyCode
    - district
    - dmaCode
    - geonameID
    - gmtOffset
    - isp
    - languages
    - latitude
    - longitude
    - metroCode
    - organization
    - regionCode
    - regionName
    - stateProv
    - timezone
    - zipcode
---

| Field | Data |
| ----- | ---- |
{% for field in page.header.fields %}
| {{ field }} | {{ attribute(config.plugins.iplocate, field) }} |
{% endfor %}

But all the fields are blank.

Any idea?

Thanks! Andrea

Perlkonig commented 7 years ago

Not sure. You're sure your key is valid? What happens if you try to access the API via the command line?

My demo page seems to be working.

andreaschiona commented 7 years ago

Thanks for your super quick response!! :)

How can I try the API via command?

andreaschiona commented 7 years ago

My plugin config is:

enabled: true
sequence:
  - geoplugin
  - freegeoip
  - ipinfo
  - dbip
keys:
  dbip: ******************************
Perlkonig commented 7 years ago

You'll have to look at each service's documentation. Here's DB-IP: https://db-ip.com/api/doc.php.

andreaschiona commented 7 years ago

I understand, the problem is that I have my grav app in a Docker container and then $_SERVER['REMOTE_ADDR'] return the ip of the container (and not the host machine ip).

Perlkonig commented 7 years ago

That's indeed a problem :smile: Good luck!