Your code seems right, check if you have fopen wrappers enabled (allow_url_fopen = On on php.ini)

Also, as mentioned by other answers, you should provide a properly encoded URI or encode it using urlencode() function. You should also check if there is any error fetching the XML string and if there is any parsing error, which you can output using libxml_get_errors() as follows:

when i used the code above this give "Error loading XML\n" only not any other message
– Asif hhhSep 22 '12 at 9:40

then the problem must be with file_get_contents($map_url). If your URI is valid and allow_url_fopen is On it may be that you need to provide a custom context when calling the function...
– NotGaeLSep 22 '12 at 11:29

that will dump a ton of gibberish and not report the errors - because you have no oid on libxml_get_errors()
– Eric SebastaJun 29 '17 at 0:59