7

I am using cakephp. I am trying get data from facebook using file_get_contents. I get a warning.

Warning (2): file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration Warning (2): file_get_contents(https://graph.facebook.com/XXXXXXX/?access_token=111978178XXXXXX|2.lg65A3c0atficNsFcf7Rog__.3600.12799XXXX-1000

Is there any way to get the data?

I appreciate any help.

Thanks.

Daniel Egeberg
  • 8,359
  • 31
  • 44
Nick
  • 385
  • 4
  • 8
  • 16

1 Answers1

11

This is a configuration issue on your server.

In your php.ini you most probably have

allow_url_fopen = Off

If you want to allow this, set it to on. Be aware though that the reason it's turned off by default is that it's more secure.

A common alternative is to use cURL instead; you might want to check if your hosting environment offers that.

kander
  • 4,226
  • 1
  • 22
  • 43
  • And for this reason it is likely that your hosting provider will block you from setting it in a local php.ini (unless you have unshared hosting). – Leo Jul 24 '10 at 09:59