http - How can I send cookies with Perl's LWP::Simple? -
use lwp::simple; use html::linkextor; use data::dumper; #my $url = shift @argv; $content = get('example.com?get=whateveriwant'); $parser = html::linkextor->new(); #create linkextor object no callbacks $parser->parse($content); #parse content
now if want send post , cookie info http header how can configure funciton? or have customize own method?
my main interest cookies! post!
lwp::simple simple http requests. if need more complex (like cookies), have upgrade full lwp::useragent. cookie_jar
http::cookies object, , can use set_cookie
method add cookie.
use lwp::useragent; $ua = lwp::useragent->new(cookie_jar => {}); # create empty cookie jar $ua->cookie_jar->set_cookie(...); $rsp = $ua->get('example.com?get=whateveriwant'); die $rsp->status_line unless $rsp->is_success; $content = $rsp->decoded_content; ...
the lwp::useragent has post
method.
Comments
Post a Comment