How can I load a remote file using file_get_contents()?

后端 未结 2 1389
孤独总比滥情好
孤独总比滥情好 2021-01-20 04:06

Scratching my head a bit now with this.
I am trying to get a file from a remote url. I can save contents from local files, but can\'t from remote.

This works:

相关标签:
2条回答
  • 2021-01-20 04:21

    check the php settings...

    it may be due to security issue... "allow_url_fopen = On"

    http://www.php.net/manual/en/function.file-get-contents.php

    0 讨论(0)
  • 2021-01-20 04:38

    Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/sites/mydomain/myfile.php on line 5`

    This would suggest you are either using an incorrect url, or DNS is not correctly set up on your server.

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