The file which I'm trying to download from my PHP script is this one:

```
http://www.navarra.es/appsext/DescargarFichero/default.aspx?codigoAcceso=OpenData&fichero=Farmacias/Farmacias.xml 

```

But I can't do it using neither `file_get_contents()` nor `cURL`. I'm getting the error `Object reference not set to an instance of an object.`

Any idea how to do it? 

Thanks a lot, Pablo.

Updated to add the code:

```
$url = "http://www.navarra.es/appsext/DescargarFichero/default.aspx?codigoAcceso=OpenData&fichero=Farmacias/Farmacias.xml";
$simple = simplexml_load_file(file_get_contents($url));
foreach ($simple->farmacia as $farmacia)
{
    var_dump($farmacia);
}

```

And **the solution** thanks to @Gordon:

```
$url = "http://www.navarra.es/appsext/DescargarFichero/default.aspx?codigoAcceso=OpenData&fichero=Farmacias/Farmacias.xml";
$file = file_get_contents($url, FALSE, stream_context_create(array('http' => array('user_agent' => 'php' ))));
$simple = simplexml_load_string($file);

```