Thanks guys, Marty
--- Tom Schindl <[EMAIL PROTECTED]> wrote: > Martin Moss wrote: > > All, > > > > I have an interesting issue. I'm in the process of > > whitelabeling a website, but part of the process I > > need to whitepabel is hosted by an outsourced > company. > > > > > > Rather than get the outsource company to change > their > > html, I would rather download and edit the html > from > > the outsourced website on the fly. > > > > I was thinking of writing a contentHandler which > uses > > LWP::Useragent etc.. to download from the > outsourced > > website. however I have only limited experience > with > > it. Also, if the page I wish to download is > itself a > > form, how would I go about getting LWP to 'submit' > > values etc... > > > > I hope you don't use this in production but this > should work if I'm not > completely mistaken: > > ------------------------8<------------------------ > package Fake::FormRequest; > > use LWP::UserAgent(); > use Apache::Constants(); > > my $ua = LWP::UserAgent->new; > > sub handler { > my $r = shift; > my $request; > > if( $r->method_number() == > Apache::Constants::M_GET ) { > $request = HTTP::Request->new(GET => > 'http://bla.com/my.cgi?'.$r->args,&getHeaderAsArrayRef($r)); > } else { > $request = HTTP::Request->new(POST => > 'http://bla.com/my.cgi?',&getHeaderAsArrayRef($r),$->content); > } > > my $response = $ua->request($request); > ## ......... > } > > sub getHeaderAsArrayRef { > my $r = shift; > my %headers = $r->headers_in(); > my @rv; > > map { push @rv, [ $_, $headers{$_} ] } keys > %headers; > > return [EMAIL PROTECTED]; > } > ------------------------8<------------------------ > > > > Kind Regards > > > > Marty > > > > > > > > > > > > > ___________________________________________________________ALL-NEW > Yahoo! Messenger - all new features - even more fun! > http://uk.messenger.yahoo.com > > > > > -- > Report problems: http://perl.apache.org/bugs/ > Mail list info: > http://perl.apache.org/maillist/modperl.html > List etiquette: > http://perl.apache.org/maillist/email-etiquette.html > > ___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html