przez fsockopen:
$header .= 'GET ... HTTP/1.0'."\r";
$header .= 'Host: '.$domain."\r";
$header .= 'Authorization: Basic '. base64_encode('login:haslo')."\r";
$header .= "\r";
$fp = @fsockopen ($host, 80, $errno, $errstr, 10);
if (!$fp) {
$ret_value = "$errstr ($errno)";
} else {
...
}
przez stream_context_create:
$ctx = stream_context_create(
array(
'http' => array(
'timeout' => 12,
'header' => 'Authorization: Basic '. base64_encode('login:haslo')
)
)
);
$xml_data = file_get_contents($url, 0, $ctx);