抓取一般的页面没问题·。
但近期给一个网站个搞晕了·。请大神们帮帮忙看看是什么原因导致失败。谢谢
我们学校的图书馆。
我用的代码如下
<?php
header ( "Content-type: text/html; charset=utf-8" );
$url = "http://183.36.249.82/";
$contents = file_get_contents($url);
echo $contents;
?>
但会出现这个错误:
Server Error in '/' Application.
Runtime Error
我用的服务器是SAE。也试过用SAE提供的fetch
功能。
但可惜也是报错。
错误是:string(3) "500" string(21) "Internal Server Error"
多天研究原因不解。求解答。谢谢
用
file_get_contents
抓取的时候,一般要设置一下HTTP context.抓取网页还是用cURL比较好.