Hi all,
I'm a mydbr newbie, even if I like this amazing tool, I have some issue for my first import. I try to generate an openstreet map using parameters from an external url (ip2location) in order to geolocalize an IP.
From a first list of IP addresses, I use the report command using :
SELECT 'dbr.report', 'sp_DBR_IP_LOCATION', 'inIP=[LAST_IP]';
The report procedure is very simple
DROP PROCEDURE IF EXISTS sp_DBR_IP_LOCATION
$$
CREATE PROCEDURE `sp_DBR_IP_LOCATION`(inIP varchar(15))
BEGIN
select 'dbr.css', 'div.title { background-color: #f4f4f4; color: black; text-align: center; vertical-align: middle; font-weight: bold; font-family: "Roboto-Light";';
select 'dbr.import.options', 'format', 'json'; select 'dbr.import', 'sp_DBR_import_IP_JSON_do' ,concat('https://api.ip2location.com/?ip=', inIP, '&key=demo&package=WS3&format=json');
END $$
When I put the url (https://api.ip2location.com/?ip=80.215.47.235&key=demo&package=WS3&format=json) in my browser, I get a perfect json message :
{"country_code":"FR","country_name":"France","region_name":"Centre-Val de Loire","city_name":"Orleans"}
But during the json import I have the error message : Fatal error: Cannot use object of type stdClass as array in /var/www/tools/mydbr/lib/import.php on line 353
DROP PROCEDURE IF EXISTS sp_DBR_import_IP_JSON_do
$$
CREATE PROCEDURE `sp_DBR_import_IP_JSON_do`(country_code varchar(100), country_name varchar(100), region_name varchar(100), city_name varchar(100))
BEGIN
select 'dbr.openstreetmap', 'address';
select city_name, concat(city_name, ', ',country_name);
END
$$
Can someone can help me please ?
Thanks for your help and have a great day