Sun*_*nny 1 php screen file-get-contents scrape
对于一个类项目,我们应该从另一个网站提取数据.我从GiantBomb.com选择了类似于给定游戏的游戏(在我的剧本中给予他们学分)
// $gameLink = "/call-of-duty-black-ops/61-26423/";
$html = file_get_contents("http://www.giantbomb.com" . urlencode($gameLink) . "games_similar/");
echo $html;
这什么都不返回.
但是,如果$ gameLink是手动输入的:
$html = file_get_contents("http://www.giantbomb.com/call-of-duty-black-ops/61-26423/games_similar/");
echo $html;
现在,它将正确返回结果.我的代码出了什么问题?我尝试urlencode()在整个链接上执行,而不仅仅是$ gameLink变量,但它仍然失败.有没有人有什么建议?