Random HTTP/1.1 503 service Unavailable

First off, your link contains your client id…

To answer your question, this is the API failing intermittently. You can surround the file_get_contents call in a try...catch block to handle API failures.