Created
July 9, 2019 05:10
-
-
Save tackme31/782f53b31212f88fe53bcf218fe20a7b to your computer and use it in GitHub Desktop.
A PowerShell script for comparing the HTMLs fetched by Invoke-WebRequest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-HtmlContent($url) | |
{ | |
Invoke-WebRequest $url ` | |
| select -ExpandProperty Content ` | |
| % {$_.Split([Environment]::NewLine, [StringSplitOptions]::RemoveEmptyEntries)} | |
} | |
$html1 = Get-HtmlContent "https://foo.example.com" | |
$html2 = Get-HtmlContent "https://bar.example.com" | |
if (-not (Compare-Object $html1 $html2)) | |
{ | |
Write-Host "no differences" | |
} | |
else | |
{ | |
Write-Host "has differences" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment