PHP file_get_contents does not work on localhost

前端 未结 7 1222
隐瞒了意图╮
隐瞒了意图╮ 2020-12-01 21:48

I am working on my website from localhost (http://172.16.65.1/) a MAMP server on OSX.
I want to load some JSON from Google and some simple tests show me I have a probl

7条回答
  •  天命终不由人
    2020-12-01 22:14

    Try this function in place of file_get_contents():

    It can be used just like file_get_contents(), but uses cURL.

    Install cURL on Ubuntu (or other unix-like operating system with aptitude):

    sudo apt-get install php5-curl
    sudo /etc/init.d/apache2 restart
    

    See also cURL

提交回复
热议问题