An unknown error occured in attempting to contact

2 years 8 months ago #3436 by sqlab
When we try to batch geolocate we get this Error:
An unknown error occured in attempting to contact Google from your server. This is required for the Geocoding function to contact Google.

Please Log in or Create an account to join the conversation.

More
2 years 8 months ago #3439 by sysgenmedia
Replied by sysgenmedia on topic An unknown error occured in attempting to contact
Sounds like you are blocking outbound calls on port 80 from the server. Perhaps there is a firewall or php configuration blocking it.

You can manually calculate coordinates one at a time by opening each location. This uses Javascript instead.

If there are a lot of locations, alternate solution would be to upload the store locator and locations to a different unblocked server and then export the list once geocoded.

Please Log in or Create an account to join the conversation.

More
2 years 7 months ago #3445 by Storm
I'm having this exact issue.

I've spoken with our host (Siteground) and they have replied with:

We checked the issue and we were able to replicate it. We got the same error message as expected, upon checking further.

We noticed this line here:

Code:

connect(4, {sa_family=AF_INET, sin_port=htons(443), sin_addr=inet_addr("172.217.23.46")}, 16) = -1 EINPROGRESS (Operation now in progress)

shows the IP address owned by google but it does not accept connections on port 443.

I highly recommend that you check the settings on this plugin or you may discuss the case with the plugin developers.

I also would like to confirm that we don't block such outgoing connections on our server.

Please Log in or Create an account to join the conversation.

More
2 years 7 months ago #3450 by sysgenmedia
Replied by sysgenmedia on topic An unknown error occured in attempting to contact
First, we re-tested this on our latest version and it is indeed working correctly.

Our Geocoder uses the Google Maps Geocoding service. We open a connection to:

maps.google.com/maps/api/geocode/json?re...ensor=false&address=

Opening this in a browser shows that they do in fact support SSL connections.

We also open this connection via the php command: file_get_contents()

Perhaps SiteGround DNS has an older IP in the cache for maps.google.com? Im showing a different Ip when i visit, but I'm sure there are many IPs servicing that domain.

Please Log in or Create an account to join the conversation.

More
1 year 7 months ago #3635 by WCCM2017
I've just had the same error report to debug. In my case the user was importing a csv file with no data for the address. When this is urlencoded and added to the Google maps call the address is blank not a string and the call fails. To debug I modified the code just before the call to display the ID, Name and Address so I could find the entry where it failed:

in batchgeocoding.php
line 68: $address = $location->address;
added: $name = $location->name;

added: $msg = "ID: $id - Name: $name - Address: $address ";
added: $app->enqueueMessage($msg, 'geocode location');

$dataResponse = file_get_contents($base_url . urlencode($address));

I've left it in so that I can see the Geocode progress.

Hope this helps someone else.

Please Log in or Create an account to join the conversation.

More
1 year 7 months ago #3636 by sysgenmedia
Replied by sysgenmedia on topic An unknown error occured in attempting to contact
Hi WCCM2017,

Thats in interesting bug you found. I like your solution as well.

We'll build that check into the next release.

Thanks!

Please Log in or Create an account to join the conversation.

More