Можно и без CURL
function wbAuthPostContents($url, $post=null, $username=null,$password=null) {
if (func_num_args()==3) {
$password=$username;
$username=$get;
$post=array();
}
if (!is_array($post)) $post=(array)$post;
$cred = sprintf('Authorization: Basic %s', base64_encode("$username:$password") );
$post=http_build_query($post);
$opts = array(
'http'=>array(
'method'=>'POST',
'header'=>$cred,
'content'=>$post
)
);
$context = stream_context_create($opts);
$result = file_get_contents($url, false, $context);
return $result;
}
В примере ещё и авторизация присутствует.