Don't roll your own basic auth, use the Curl built in.