I'd like to fopen this url: http://ec.europa.eu/eurostat/SDMX/diss-web/rest/data/hlth_cd_asdr/A..T.TOTAL.A-R_V-Y./startperiod=2010&endPeriod=2010 like this:
$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');
but it fails with the following warning:
failed to open stream: HTTP request failed! HTTP/1.1 502 Bad Gateway
What should I do to open this link in PHP?
fopen() wouldn't support http requests so you can use file_get_content()
in your scanario. For more detail please read fopen() and file_get_contents() from php.net.