file_get_contents() error

前端 未结 2 631
孤城傲影
孤城傲影 2020-12-06 12:05

I am using file_get_contents on my PHP and it throws some errors:

My code

#try to fetch from remote
$this->remotePath = \"http://some-hostname.com         


        
相关标签:
2条回答
  • 2020-12-06 12:25

    Your server must have the allow_url_fopen property set to true. Being on a free webhost explains it, as it's usually disabled to prevent abuse. If you paid for your hosting, get in contact with your host so they can enable it for you.

    If changing that setting is not an option, then have a look at the cURL library.

    0 讨论(0)
  • 2020-12-06 12:26

    It seems "allow_url_fopen" setting is false on your server and hence does not allow using URLs with file_get_contents().

    Try using CURL instead that is a better and efficient way of communicating with other server.

    0 讨论(0)
提交回复
热议问题