Invoke-WebRequest

Please Visit: http://ift.tt/1ajReyV



PowerShell: Sending Http Request

Invoke-WebRequest

http://ift.tt/1cP1RPN

$r = Invoke-WebRequest -URI http://ift.tt/1fIiM6p

$r.AllElements | where {$.innerhtml -like "*=*"} | Sort { $.InnerHtml.Length } | Select InnerText -First 5



PowerShell: Executing a .NET Web Request

http://ift.tt/1fIiJI1

# // first argument is mapped to $url



$url="http://localhost:8983/solr/select?fl=contentid&q=contentid"

param($url)



# // create a request

[Net.HttpWebRequest] $req = [Net.WebRequest]::create($url)

$req.Method = "GET"

$req.Timeout = 600000 # = 10 minutes



# // Set if you need a username/password to access the resource

#$req.Credentials = New-Object Net.NetworkCredential("username", "password");



[Net.HttpWebResponse] $result = $req.GetResponse()

[IO.Stream] $stream = $result.GetResponseStream()

[IO.StreamReader] $reader = New-Object IO.StreamReader($stream)

[string] $output = $reader.readToEnd()

$stream.flush()

$stream.close()



# // return the text of the web page

Write-Host $output



from Google Plus RSS Feed for 101157854606139706613 http://ift.tt/1cP1RPN

via LifeLong Community

No comments:

Post a Comment