HTTPS POST with basic authentication

Hi
I need to do a https POST with basic authentication to query a service. I am
unable to find this in api or any of the blog entries I am seen so far. Is
it possible to do this ?

Have you tried including your username and password in the url when
you create your uri for the POST request?

For example, http://foo:bar@www.domain.com, where foo is your username
and bar is your password.

···

On 9/12/08, Piyush Ranjan <piyush.pr@gmail.com> wrote:

Hi
I need to do a https POST with basic authentication to query a service. I am
unable to find this in api or any of the blog entries I am seen so far. Is
it possible to do this ?

I need to do a https POST with basic authentication to query a service. I am
unable to find this in api or any of the blog entries I am seen so far. Is
it possible to do this ?

  require 'base64' # NOTE: the name of this module may be different

  headers = {}
  headers['Authorization'] = 'Basic ' + encode64("#{user}:#{pass}").chop
  resp = http.post(path, body, headers)

Hope this helps,

Bill

···

From: "Piyush Ranjan" <piyush.pr@gmail.com>

thanks bill
this is exactly what I implemented

Piyush

···

On Sat, Sep 13, 2008 at 1:47 AM, Bill Kelly <billk@cts.com> wrote:

From: "Piyush Ranjan" <piyush.pr@gmail.com>

I need to do a https POST with basic authentication to query a service. I
am
unable to find this in api or any of the blog entries I am seen so far. Is
it possible to do this ?

require 'base64' # NOTE: the name of this module may be different

headers = {}
headers['Authorization'] = 'Basic ' + encode64("#{user}:#{pass}").chop
resp = http.post(path, body, headers)

Hope this helps,

Bill