Stanislas Piotrowski
Stanislas Piotrowski

Reputation: 2694

trouble with google map

I have any adress recorded in my databse corresponding to the customers.

The trouble I met is concerning the including of a googlemap.

I have the following code that convert an adress to the polares.

function getCoordonnees($adresse) {
    $url = "http://maps.google.com/maps/geo?q=" . urlencode($adresse) .
            "&output=csv";
    $csv = file($url);
    $donnees = preg_split("#,#", $csv[0]);
    return $donnees[2] . "," . $donnees[3];
}

The following code returns to me somethinbg like that

48.9381235,2.1329083

When I use the google map I have a picture like that :

enter image description here

Which comes from this url (generated by my function

http://maps.google.com/staticmap?center=48.9381235,2.1329083&zoom=15&size=300x300&maptype=mobile&markers=48.9381235,2.1329083,red&key=***********************KEY*GOOGLEMAP************&sensor=false

When I try to display that picture in my website, An error appears,

<img src="http://maps.google.com/staticmap?center=<?php echo $polar; ?>&zoom=15&size=300x300&maptype=mobile&markers=<?php echo $polar; ?>,red&key=***********************KEY*GOOGLEMAP************&sensor=false" style="border:double 2px" />

Where $polar is the polares.

Including this code in my website returns to me the following mistake :

Failed to load resource: the server responded with a status of 403 (Forbidden) 

I have no idea from where comes this error. Actualy I do not think it comes from google map because on stackoverflow, the picture is displayed.

So I would ask if anybody know where can comes this mistake ? Is is from the server configuration or something else ? I've been looking for that since many times without answer.

Anykind of help will be much appreciated.

Upvotes: 2

Views: 867

Answers (1)

possnfiffer
possnfiffer

Reputation: 11

I was having the same issue and I decided to turn on Google Maps API v2 I already had Google Maps API v3 on but before messing with to many settings I turned them both on. Now it works

Upvotes: 1

Related Questions