2014-12-19 45 views
1

我正在使用該代碼運行地理編碼,什麼作品完美: $ url ='http://maps.googleapis.com/maps/api/geocode/json?address='。 $地址。 '& sensor = false';Google地理編碼僅在沒有API密鑰的情況下運行

問題是,它只能運行幾個地址(大約200),然後它停下來,所以我必須等24小時才能再次開始地理編碼。

因此,我創建了一個API密鑰,以便每天對地址進行2500個地址的地理編碼,並像這樣添加它: $ url = http://maps.googleapis.com/maps/api/geocode/json?&address=。 $地址。 & sensor = false & key = MY_API_KEY;

問題現在是,沒有任何反應。沒有地址正在進行地理編碼。只有沒有API密鑰它適用於幾個地址。我還嘗試了不同的密鑰,使用特定的引薦來源,不使用引薦來源 - 沒有任何變化。不僅一個地址正在進行地理編碼。

謝謝你的幫助!

回答

5

看,當你調用API用鑰匙時返回的錯誤信息:

http://maps.googleapis.com/maps/api/geocode/json?&address=New%20York,NY&sensor=false&key=my_api_key

{ 
    "error_message" : "Requests to this API must be over SSL.", 
    "results" : [], 
    "status" : "REQUEST_DENIED" 
} 

您需要使用https:協議。

https://maps.googleapis.com/maps/api/geocode/json?&address=New%20York,NY&sensor=false&key=my_api_key

{ 
    "error_message" : "The provided API key is invalid.", 
    "results" : [], 
    "status" : "REQUEST_DENIED" 
} 
+0

非常感謝!這解決了這個問題。 – user3392296 2014-12-20 14:54:05

+0

如果這解決了你的問題,請[接受它](http://meta.stackoverflow.com/questions/5234/how-does-accepting-an-answer-work) – geocodezip 2014-12-20 16:39:19

相關問題