CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I Need a Programmer for Freelance Work:
Reply to: Re: Programming Consultant needed
 
Subject:
Guest Username:
E-mail address:
Post Style:      Get Markup Help
Icon:
none









Post:




Replying to: Re: Programming Consultant needed by Kanji
Post:

In Reply To
1) How does a browser normally prepare to POST multiple select menus and / or multiple fields with the same name attribute (eg checkboxes), and how do I emulate this when preparing the data hash for the request object?

Each value of same-name fields are reproduced in key=value fashion as if they were the only one, and then stringed together later on as you would for any other field you need to add either directly with HTTP::Request's new or content methods.


Code
    $req = HTTP::Request->new( POST => $url ); 
$req->content("field=value1&field=value2&ad=nauseum");

Personally, I find it much easier to use HTTP::Request::Common instead, and let it build my query strings for me.


Code
    $req = POST $url, [ 
"field" => "value1",
"field" => "value2",
"ad" => "nauseum",
];


In Reply To
2) How do I prepare the headers for www_authenticate or authorization?

There's a few ways, but the easist is probably using HTTP::Request's authorization_basic method.


Code
    $req->authorization_basic( "username", "password" );

Other alternatives include tacking on an Authorization header, using LWP::UserAgent's credentials method, or overriding LWP::UserAgent's get_basic_credentials; each of which have their pros and cons.




Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives