daily pastebin goal
40%
SHARE
TWEET

Untitled

a guest Jul 17th, 2016 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function search-custom() {
  2.     Param(
  3.         [Parameter(Mandatory = $true)][string]$search,
  4.         [AllowEmptyString()] $customsearch_id = "006759091738829999417%3A-ynq7qhchoc",
  5.         [AllowEmptyString()]$api_key="<your key>"
  6.     )
  7.    
  8.     try {
  9.     $Search_results = invoke-restmethod "https://www.googleapis.com/customsearch/v1?q=$search&cr=us&cx=$customsearch_id&key=$api_key"
  10.     $search_results = ($search_results.items) | select title, snippet,link
  11.     return $search_results
  12.     } catch {
  13.     return $false
  14.     }
  15. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top