Last active
September 2, 2016 19:10
-
-
Save thomasrayner/690844751c1fe5f1fca2169237dc66f8 to your computer and use it in GitHub Desktop.
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-SearchResults { | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory,Position=0)] | |
[string]$SearchTerms | |
) | |
$searchURL = "http://www.bing.com/search?q=$([System.Web.HttpUtility]::UrlEncode($searchTerms))" | |
$searchResults = Invoke-WebRequest $searchURL | |
$searchResults.links | ? { $_.href -match 'http' } | select innertext,href -first 10 | |
} | |
#example | |
Get-SearchResults -SearchTerms 'two bears slow dancing' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment