Invoke-WebRequest, POST 带参数 [英] Invoke-WebRequest, POST with parameters

查看:94
本文介绍了Invoke-WebRequest, POST 带参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试 POST 到一个 uri,并发送参数 username=me

I'm attempting to POST to a uri, and send the parameter username=me

Invoke-WebRequest -Uri http://example.com/foobar -Method POST

如何使用 POST 方法传递参数?

How do I pass the parameters using the method POST?

推荐答案

把你的参数放在一个哈希表中并像这样传递它们:

Put your parameters in a hash table and pass them like this:

$postParams = @{username='me';moredata='qwerty'}
Invoke-WebRequest -Uri http://example.com/foobar -Method POST -Body $postParams

这篇关于Invoke-WebRequest, POST 带参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆