whilst I am currently using Google Maps, when I click on the find longitude / Latitude button for a listing using an entered a valid address in the UK I get the following message
"Wrong parameters passed or incorrect address! Please try to write this address in a different format." I've tried entering a valid US address and the same message
I have an API key generated for the site and set up in the Mappings API tab under general settings so Maps Javascript API is enabled for the site
is there anything else I need to enable or is there a specific format required when entering an address to make the call work ?
Thanks in advance
find longitude / latitude button in listings
Moderator: alexandrleonenko
-
- Newbie
- Posts: 3
- Joined: Nov 25th, '20, 19:54
-
- Site Admin
- Posts: 6175
- Joined: Jan 7th, '09, 23:18
- Contact:
Re: find longitude / latitude button in listings
Contact support and provide them access to your website to check what happens.
-
- Newbie
- Posts: 3
- Joined: Nov 25th, '20, 19:54
Re: find longitude / latitude button in listings
further digging and checking has resolved the problem.
in the file
CGeoLocacation.php stored in the directory \framework\helpers\ the call to the google maps api is made using the command "file_get_contents()'
the server hosting company I use has disabled that functionality and superseded it with Curl
if you are having the same issue then try substituting the following lines over
In the function coordinatesByAddress
comment out the current code
add in something along the lines of
no other changes are needed and the find location / latitude button should work for you.
if admin / support has time, they may even be able to code it so it chooses what code to run depending on the server set up.
in the file
CGeoLocacation.php stored in the directory \framework\helpers\ the call to the google maps api is made using the command "file_get_contents()'
the server hosting company I use has disabled that functionality and superseded it with Curl
if you are having the same issue then try substituting the following lines over
In the function coordinatesByAddress
comment out the current code
Code: Select all
[$json = file_get_contents($url);
$json=readfile($url);
$json = json_decode($json);
add in something along the lines of
Code: Select all
$ch = curl_init();
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
if(FALSE === ($retval = curl_exec($ch))) {
error_log(curl_error($ch)); }
$json = json_decode($retval);
no other changes are needed and the find location / latitude button should work for you.
if admin / support has time, they may even be able to code it so it chooses what code to run depending on the server set up.
-
- Site Admin
- Posts: 6175
- Joined: Jan 7th, '09, 23:18
- Contact:
Re: find longitude / latitude button in listings
In CHttpRequest method getUrlContent() have following parameters:
by default this method called with 'curl'
so, you may define which option to use according to your needs.
Code: Select all
function getUrlContent($url = '', $method = 'get', $data = [], $params = [], $function = 'file_get_contents')
by default this method called with 'curl'
Code: Select all
$json = A::app()->getRequest()->getUrlContent($url, 'get', [], [], 'curl');
so, you may define which option to use according to your needs.