1
为什么PHP的file_get_contents不适用于某些URL?PHP file_get_contents不适用于某些URL
<?php
$html = file_get_contents('http://modagram.com');
?>
对于上面我收到这样的警告:
PHP Warning: file_get_contents(http://modagram.com): failed to open stream: HTTP request failed! in /var/www/html/scraping/test.php on line 2
可以确认您在php.ini中将'allow_url_fopen'设置为ON? – ChelseaStats 2014-10-29 13:14:56
allow_url_open设置为是,它也适用于其他网址,但不适用于http://modagram.com – torayeff 2014-10-29 13:18:35
@Glavić我看着那个线程,但有解决方案没有解释 – torayeff 2014-10-29 13:20:46