1.file_get_contents
2.curl
3.fopen->fread->fclose
file_get_contents、fopen、curl区别分析:
1.使用file_get_contents和fopen必须空间开启allow_url_fopen。
方法:编辑php.ini,设 置 allow_url_fopen = on,allow_url_fopen关闭时fopen和file_get_contents都不能打开远程文件。
2.使用curl必须空间开启curl。
方法:win下修改php.ini,将extension=php_curl.dll前面的分号去掉, 而且需要拷贝ssleay32.dll和libeay32.dll到c:\windows\system32下;
linux下要安装curl扩展。
建议打开url时使用file_get_contents()方法,可优化打开速度
