I have this parameters to download a XML file:
wget --http-user=user --http-password=pass http://www.example.com/file.xml
How I have to use
If the aim is to just load the contents inside your application, you don't even need to use wget
:
$xmlData = file_get_contents('http://user:pass@example.com/file.xml');
Note that this function will not work if allow_url_fopen is disabled (it's enabled by default) inside either php.ini or the web server configuration (e.g. httpd.conf).
If your host explicitly disables it or if you're writing a library, it's advisable to either use cURL or a library that abstracts the functionality, such as Guzzle.
use GuzzleHttp\Client;
$client = new Client([
'base_url' => 'http://example.com',
'defaults' => [
'auth' => ['user', 'pass'],
]]);
$xmlData = $client->get('/file.xml');