PHP Classes

How to add the API KEY?

Recommend this page to a friend!

      Google map  >  All threads  >  How to add the API KEY?  >  (Un) Subscribe thread alerts  
Subject:How to add the API KEY?
Summary:I want to use my Google API Key to track usage but can't see how
Messages:4
Author:X
Date:2011-11-28 01:26:43
Update:2011-11-28 01:52:46
 

  1. How to add the API KEY?   Reply   Report abuse  
Picture of X X - 2011-11-28 01:26:43
Hi
Can anyone tell me how / where I can modigy the code to make use of my API key and use it that way rather than as an anonymous user? It will let me track usuage that way. This is what I tried so far (without success). There is a line around line 47 that goes like this:

echo '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>';

That, as far as I can tell, speaking as a Maps virgin, is the anonymous reference. So I substituted it with the format that 'Keys' references make which looks like this:

echo '<script type="text/javascript" src="http://maps.google.com/maps?file=api&key=MY-KEY-GOES-IN-HERE"></script>';

When I try that it doesn't work, nothing happens. Can anyone offer me some insigth into this and how to fix it?

Thanks for thinking about this!

Frank X

  2. Re: How to add the API KEY?   Reply   Report abuse  
Picture of X X - 2011-11-28 01:29:26 - In reply to message 1 from X
P.S.
Doh! I just spotted the issue. I left off one parameter from the end of my version! I added

?sensor=false

and then it all worked fine. False alarm people. Thanks again.

Frank X

  3. Re: How to add the API KEY?   Reply   Report abuse  
Picture of X X - 2011-11-28 01:38:18 - In reply to message 2 from X
OK I hate this 'forum' interface. My last post was wrong and I can't delete it. Sorry.

So the problem is NOT fixed. What I thought was fixed was merely my edit was commented out and it was working in anonymous mode still, so if anyone has any bright ideas on how to insert the key, feel free to share! Thanks.

Frank X

  4. Re: How to add the API KEY?   Reply   Report abuse  
Picture of X X - 2011-11-28 01:52:46 - In reply to message 3 from X
Ok fixed
The Google documentation says you can just add
&key=[YOUR KEY GOES HERE]
as a parameter to ANY Google api call. So I tested that and voila, it's true. Problem nailed!

Cheers

Frank X