From 2e404e7a0992ea14020baf42fea7921f13961aa1 Mon Sep 17 00:00:00 2001 From: Alex Kup <116945542+Lifailon@users.noreply.github.com> Date: Mon, 21 Aug 2023 11:54:12 +0300 Subject: [PATCH] Add converter url to text --- Scripts/ConvertFrom-Html.psm1 | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Scripts/ConvertFrom-Html.psm1 diff --git a/Scripts/ConvertFrom-Html.psm1 b/Scripts/ConvertFrom-Html.psm1 new file mode 100644 index 0000000..43fd01d --- /dev/null +++ b/Scripts/ConvertFrom-Html.psm1 @@ -0,0 +1,13 @@ +function ConvertFrom-Html { + param ( + [Parameter(ValueFromPipeline)]$url + ) + $irm = Invoke-RestMethod $url + $HTMLFile = New-Object -ComObject HTMLFile + $Bytes = [System.Text.Encoding]::Unicode.GetBytes($irm) + $HTMLFile.write($Bytes) + ($HTMLFile.all | where {$_.tagname -eq "body"}).innerText +} + +# $apache_status = "http://192.168.3.102/server-status" +# $apache_status | ConvertFrom-Html \ No newline at end of file