Why file_get_contents is not woking on same domain, but https/facebook.com is success

I think the issue you’re experiencing is caused by this security system:

In short, it will prevent anyone from using file_get_contents to download stuff from your website from anywhere, including our own hosting.

Note that if you just want to read local files from your account, you should use file_get_contents with a local path, instead of a website URL. Reading files directly is much faster and more efficient than pulling them through the web server.