On Fri, Jul 28, 2017 at 9:49 AM, ToddAndMargo <toddandma...@zoho.com> wrote: >>> Hi All, >>> >>> I am trying to convert a p5 program to p6. What do I use in >>> place of `LWP::UserAgent`? >>> >>> I use it for downloading files from the web. I need to be able >>> to pass the following to the web page: >>> >>> Caller >>> Host >>> UserAgent >>> Referer >>> Cookies >>> >>> This is the p5 code I want to convert: >>> >>> http://vpaste.net/gtJgj >>> >>> Any words of wisdom? >>> >>> Many thanks, >>> -T > > On 07/27/2017 10:30 PM, Gabor Szabo wrote: >> >> LWP::Simple now allows you to set the header of your request. >> See my recent article with examples: >> http://perl6maven.com/simple-web-client >> I hope this helps. >> >> regards >> Gabor >> >> On Fri, Jul 28, 2017 at 7:42 AM, Todd Chester <toddandma...@zoho.com> >> wrote: > > > > I see your article. I do believe this is what I want. > <code> > { > "args": { > "language": "Perl", > "math": "19+23=42", > "name": "Larry Wall" > }, > "headers": { > "Connection": "close", > "Host": "httpbin.org", > "User-Agent": "LWP::Simple/0.090 Perl6/rakudo" > }, > "origin": "17.19.208.37", > "url": "http://httpbin.org/get?name=Larry > Wall&language=Perl&math=19%2B23%3D42" > } > </code> > > Questions: > > 1) may I leave off the `args` and only include the `headers`? > > 2) I need an example with headers. I have no clue what goes > before the first "{" > > Many thanks, > -T
I think you quoted the response here and not the request. What you need I think is the last example on that page. Something like this: my $html = LWP::Simple.new.get("http://httpbin.org/headers", { "User-Agent" => "Perl 6 Maven articles", "Zone" => "q" } ); Gabor