Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Authentication #1

Open
lorn opened this issue Oct 28, 2011 · 0 comments
Open

Basic Authentication #1

lorn opened this issue Oct 28, 2011 · 0 comments
Assignees

Comments

@lorn
Copy link
Owner

lorn commented Oct 28, 2011

Boa tarde Lorn! Preciso tirar uma dúvida com vc em relação ao módulo LWP::Curl. Será que vc pode me ajudar?
A pergunta é simples. Como eu poderia fazer autenticação usando o LWP::Curl?
4:34
You have connected

5:10
Lindolfo 'Lorn' Rodrigues
opa
tá aí?
eu não tava aqui

5:11
Andre Carneiro
opa, no cricket!
Eu fiz a autenticação direto usando o agent que tem no objeto do LWP::Curl, que é um objeto WWW::Curl::Easy.

5:11
Lindolfo 'Lorn' Rodrigues
eu confesso que nunca fiz, mas auth padrão http deve funcionar vc já tentou http://usuario:[email protected] ?
blz!

5:12
Andre Carneiro
Tem que passar o auth:BASIC tb...

5:12
Lindolfo 'Lorn' Rodrigues
ah tá
meu modulo é muito mais usado do que eu pensei

5:13
Andre Carneiro
Seria interessante ter algo parecido com o método credentials do LWP::UserAgent ??

5:13
Lindolfo 'Lorn' Rodrigues
na verdade eu vou copiar a ideia do mechanize, que é assim:
my $agent = WWW::Mechanize->new();
$agent->default_header(
Authorization => "Basic " .
MIME::Base64::encode( 'usuario' . 'senha') );
pow, vou colocar como feature agora no github, vou ver se pego no fds

5:14
Andre Carneiro
Ah sim... já facilita pra caramba...

my $lwpcurl = LWP::Curl->new();

my $curl = $lwpcurl->{agent};

$curl->setopt(CURLOPT_URL,'http://restful.painel.localhost/index.php/Restful/AddTransactionalCampaign/');
$curl->setopt(CURLOPT_USERPWD, "interNalDataInf:keo+9e_21");
$curl->setopt(CURLOPT_POST, 1);
$curl->setopt(CURLOPT_POSTFIELDS, 'auth=BASIC&message=NICE!');

@ghost ghost assigned lorn Oct 28, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant