TechChef
TechChef

Reputation: 39

Lat long api does'not work

After a long search and implementation i am here to need your help..I am using google api to calculate lat long; for this in code i call the api like below mentioned

$jsondata=file_get_contents(@'maps.googleapis.com/maps/api/geocode/json?address="75300+Karachi+PK"&sensor=false’');

but it return me null array data; but if same url of api if i type on browser like http://maps.googleapis.com/maps/api/geocode/json?address=%2275300+Karachi+PK%22&sensor=false&#8217 then it shows me the data in array

what i get mostly in searches that the error is because more than 2500 requests, however i am not sending a 2500 requests obviously.

really appreciate any help; please guide id there is any mistake in my code

Upvotes: 0

Views: 84

Answers (2)

Yaroslav  Osetrov
Yaroslav Osetrov

Reputation: 894

$jsondata=file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?address="75300+Karachi+PK"&sensor=false’');

Upvotes: 1

Glavić
Glavić

Reputation: 43552

You are missing http:// in url when you call file_get_contents.

p.s. and remove that @ in function call.

Upvotes: 0

Related Questions