enter image description here

I am trying to get map from address but there are appear some error like You have exceeded your request quota for this API in my console so can anyone help me to fix this.

My Javascript code look like below so please check and let me know if i am doing something wrong...


$geocode = file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$address.'&sensor=false');
$output = json_decode($geocode); //Store values in variable 

if($output->status == 'OK'){ // Check if address is available or not
    $latitude = $output->results[0]->geometry->location->lat; //Returns Latitude
    $longitude = $output->results[0]->geometry->location->lng; // Returns Longitude
else {
    echo "Sorry we can't find this location.Check the details again!";

<script type="text/javascript">
    jQuery(document).ready(function () {
        // Define the latitude and longitude positions
        var latitude = parseFloat("<?php echo $latitude; ?>"); // Latitude get from above variable
        var longitude = parseFloat("<?php echo $longitude; ?>"); // Longitude from same
        var latlngPos = new google.maps.LatLng(latitude, longitude);

        // Set up options for the Google map
        var myOptions = {
            zoom: 14,
            center: latlngPos,
            mapTypeId: google.maps.MapTypeId.ROADMAP,
            zoomControlOptions: true,
            zoomControlOptions: {
                style: google.maps.ZoomControlStyle.LARGE

        // Define the map
        map = new google.maps.Map(document.getElementById("map"), myOptions);

        // Add the marker
        var marker = new google.maps.Marker({
            position: latlngPos,
            map: map,
            title: "Your Location"

  • You've missed the point this site about. The keyword is "WordPress".
    – Max Yudin
    Sep 14 '18 at 8:24
  • To elaborate on that, while your question may occur in the context of WordPress it's not actually a question about WordPress; there's not so much as a single WordPress function in the shared code. Since this is a question about the Google Maps API, you'd have better luck asking it in the official support channels for the Google Maps API.
    – bosco
    Sep 17 '18 at 16:05

Welcome to the new world of Google Maps :( You now have to have your credit card linked to your Google Maps API. They give you $250 a month of "credit" so you will likely not get charged, but you do have to have the card linked.



There's nothing wrong with your code , its just that the daily limit to access Google API is over.

Google API has a daily free quota. For Google Places API it's 2500 requests per day and 10 requests per second. If you want to use more than that, I would suggest to enable billing. If you still want to use the free quota, please wait for a day to get those 2500 requests again.

Note : The quota is based on specific accounts. Please make your own API key using Google API console if you're using a random one.

To know more about this refer this link

Hope this helps.

Not the answer you're looking for? Browse other questions tagged or ask your own question.