file_get_contents返回400 Bad Request

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)

Seems small mistake remove space from street address

echo 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');

Unencoded spaces are not allowed in URLs.

From the web services documentation "Building a Valid URL":

By popular convention, spaces (which are not allowed within URLs) are often represented using the plus '+' character as well.