public
Description: My personal dotfiles for vim, powershell, bash and other tools
Homepage: http://winterdom.com/weblog/
Clone URL: git://github.com/tomasr/dotfiles.git
dotfiles / scripts / wpost.ps1
100644 20 lines (14 sloc) 0.456 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
param([string] $url, [string] $file, [string] $contentType='text/xml')
 
$wr = [net.HttpWebRequest]([net.WebRequest]::Create($url))
$wr.Method = 'POST'
$wr.ContentType = $contentType
$is = $wr.GetRequestStream()
 
$content = [string](gc $file)
$isw = new-object io.StreamWriter $is
$isw.Write($content)
$isw.Flush()
$isw.Close()
 
$resp = $wr.GetResponse()
 
write $resp.Status
 
$sr = new-object io.StreamReader $resp.GetResponseStream()
write $sr.ReadToEnd()