How do i get file_get_contents to work in wordpress

It seems file_get_contents() isn’t active in your server. Instead, use the wp_remote_get().

Note wp_remote_get() is among the family of WordPress HTTP API specifically used for sending GET requests.

The advantage of wp_remote_get() over file_get_contents() and other PHP stream/transport function is – The WordPress HTTP API was created to standardize a single API that handled everything with regards to HTTP as simply as possible. The HTTP API supports various PHP HTTP transports or implementations to cater for different hosting environments and configurations.

In a nutshell, if file_get_contents() isn’t enabled, wp_remote_get() will use cURL if available, if not, it find and uses any available HTTP transport.