With the Google Maps API I want to get the distances to different places. I works well if I only deliver the place (without the street) to the API. If I add the street to my query (with file_get_contents) I got the 400 Bad Request. If I type the query in my browser I get the correct JSON-return
This is the query that failed:
file_get_contents(https://maps.googleapis.com/maps/api/distancematrix/json?origins=Laischaftsstr. 38 Osnabrück&destinations=München|Potsdam|Dortmund|Flensburg|Berlin&sensor=false)
This is the query that works fine:
file_get_contents(https://maps.googleapis.com/maps/api/distancematrix/json?origins=Osnabrück&destinations=München|Potsdam|Dortmund|Flensburg|Berlin&sensor=false)