It depends on the language you're using, as there are often libraries to help you. Here's a quick example using Perl:
my $auth_string = "user:word";
my $client = REST::Client->new();
$client->addHeader( "Authorization", "Basic ".encode_base64($auth_string));
Retrieving data ...