Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Maps API Key Error
    primarykey
    data
    text
    <p>I'm trying to connect my PHP script to the google maps API using CURL it connects fine but when i pass the API key it says that it is not valid, below is some of the code I'm using to get stats...</p> <pre><code>&lt;?php $url = 'https://maps.google.com/maps/api/geocode/json?address={ADDRESS}&amp;sensor=false&amp;key={MY_KEY}'; $cURL = curl_init(); curl_setopt($cURL, CURLOPT_URL, $url); curl_setopt($cURL, CURLOPT_HTTPGET, true); curl_setopt($cURL, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($cURL, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Accept: application/json' )); curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($cURL); curl_close($cURL); ?&gt; </code></pre> <p>I have tried configuring my API keys for both server (set by IP address) and browser (set by Domain Name) on the Google API page at <a href="https://code.google.com/apis/console/" rel="nofollow">https://code.google.com/apis/console/</a></p> <p>The problem that I'm having is every time i send a request i get a return JSON message saying:</p> <pre><code>stdClass Object ( [error_message] =&gt; This site or IP is not authorized to use this API key. [results] =&gt; Array ( ) [status] =&gt; REQUEST_DENIED ) </code></pre> <p>If i try to goto the url in a web browser on the computer in question <a href="https://maps.google.com/maps/api/geocode/json?address=The%20White%20House,%20Washington&amp;sensor=false&amp;key=" rel="nofollow">https://maps.google.com/maps/api/geocode/json?address=The%20White%20House,%20Washington&amp;sensor=false&amp;key=</a>{MY_KEY} i get the same problem:</p> <pre><code>{ "error_message" : "This site or IP is not authorized to use this API key.", "results" : [], "status" : "REQUEST_DENIED" } </code></pre> <p>Server type:</p> <ul> <li><strong>O/S:</strong> Windows Server 2008 R2 x64</li> <li><strong>Server:</strong> UwAmp 2.2.1</li> <li><strong>PHP:</strong> 5.4.15</li> <li><strong>MySQL:</strong> 5.6.11</li> </ul> <p>Thanks in advance for any help!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload