Inserting Google API key into Google Geocode
-
Hello Everyone,
After moving host, I am getting the following error. Basically, it is telling me that I need to insert a google authentication key for the Google Geocode API.
<strong>PHP Warning: file_get_contents(https://maps.googleapis.com/maps/api/geocode/json?address=Basildon%2C+United+Kingdom): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in /home/jksastro/public_html/wp-content/plugins/pdf-after-checkout-generator/pdf_after_checkout_generator.php on line 103</strong><em>
Can anyone tell me where about’s I insert “key=API_KEY” into my code below? I have tried, I cannot work out where about’s I would need to insert it.
$location = json_decode(file_get_contents('https://maps.googleapis.com/maps/api/geocode/json?address='.urlencode($town.', '.$country)), true)['results'][0]['geometry']['location'];
Any help is much appreciated.
Jamie
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Inserting Google API key into Google Geocode’ is closed to new replies.