> On Tue, Apr 7, 2020 at 12:15 PM ToddAndMargo via perl6-users
> <perl6-us...@perl.org <mailto:perl6-us...@perl.org>> wrote:
>
> How do I read (download) a web page? get?
On 2020-04-07 02:55, Veesh Goldman wrote:
Your question is way to vague. What do you actually want to do? If you
just wanna download a page, use curl or some other tool, no reason to do
it from raku if there's nothing more than that.
If you want more than that, then please be more specific.
Hi Veesh,
My question sounded vague as it was meant to be simple.
I wanted to give a url and get back the HTML of the url.
As far as curl goes, I wrote a module that
interfaces with curl. It would do this perfectly,
except I wanted something very simple in this instance:
a pea shooter instead of a howitzer (my curl module).
$ raku -e 'use HTTP::Client; my $client=HTTP::Client.new;
my $response = $client.get("http://checkip.dyndns.org/");
say $response.content;
(my $x=$response.content) ~~ s/.*? "Address: "//;
$x~~s/\< .* //;
say "WAN IP Address is " ~ $x;'
<html><head><title>Current IP Check</title></head><body>Current IP
Address: 50.37.24.122</body></html>
WAN IP Address is 50.37.24.122
Now is there were nasty redirects to follow or cookie or
referrers or headers to input, yada, yada yada, my curl
module would work perfect. I just wanted something simple
this time.
-T