PHP fopen()无法打开url资源

时间:2014-11-27 18:45:53

标签: php url fopen

我想打开这个网址:http://ec.europa.eu/eurostat/SDMX/diss-web/rest/data/hlth_cd_asdr/A..T.TOTAL.A-R_V-Y./startperiod=2010&endPeriod=2010 像这样:

$stream=fopen('http://ec.europa.eu/eurostat/SDMX/diss-web/rest/data/hlth_cd_asdr/A..T.TOTAL.A-R_V-Y./startperiod=2010&endPeriod=2010','r');

但它失败并出现以下警告:

failed to open stream: HTTP request failed! HTTP/1.1 502 Bad Gateway

如何在PHP中打开此链接?

1 个答案:

答案 0 :(得分:1)

fopen()不支持http请求,因此您可以在方案中使用file_get_content()。有关详细信息,请阅读php.net中的fopen()file_get_contents()

相关问题