Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell中是否有类似于Python中的请求或Ruby中的Mechanize的HTTP库?_Http_Powershell_Http Headers_Httprequest - Fatal编程技术网

Powershell中是否有类似于Python中的请求或Ruby中的Mechanize的HTTP库?

Powershell中是否有类似于Python中的请求或Ruby中的Mechanize的HTTP库?,http,powershell,http-headers,httprequest,Http,Powershell,Http Headers,Httprequest,Powershell中是否有类似于Python中的请求或Ruby中的Mechanize的HTTP库? 我想要的是一个PowerShell库,它可以轻松发送GET,POST请求,并轻松管理请求之间的Cookie。这种图书馆存在吗?谢谢。您似乎正在寻找(需要PowerShell v3)。您提到的任何一个库我都不知道,但听起来好像调用WebRequest可以做些什么。为此,您将需要PowerShell v3。下面是此命令的示例。还有其他一些例子 PS C:\> # Sends a sign-in

Powershell中是否有类似于Python中的请求或Ruby中的Mechanize的HTTP库?
我想要的是一个PowerShell库,它可以轻松发送
GET
POST
请求,并轻松管理请求之间的Cookie。这种图书馆存在吗?谢谢。

您似乎正在寻找(需要PowerShell v3)。

您提到的任何一个库我都不知道,但听起来好像调用WebRequest可以做些什么。为此,您将需要PowerShell v3。下面是此命令的示例。还有其他一些例子

PS C:\> # Sends a sign-in request by running the Invoke-WebRequest cmdlet. The command specifies a value of "fb" for the SessionVariable parameter, and saves the results in the $r variable.

$r=Invoke-WebRequest http://www.facebook.com/login.php -SessionVariable fb

# Use the session variable that you created in Example 1. Output displays values for Headers, Cookies, Credentials, etc. 

$fb

# Gets the first form in the Forms property of the HTTP response object in the $r variable, and saves it in the $form variable. 

$form = $r.Forms[0]

# Pipes the form properties that are stored in the $forms variable into the Format-List cmdlet, to display those properties in a list. 

$form | Format-List

# Displays the keys and values in the hash table (dictionary) object in the Fields property of the form.

$form.fields

# The next two commands populate the values of the "email" and "pass" keys of the hash table in the Fields property of the form. Of course, you can replace the email and password with values that you want to use. 

$form.Fields["email"] = "User01@Fabrikam.com"
$form.Fields["pass"] = "P@ssw0rd"

# The final command uses the Invoke-WebRequest cmdlet to sign in to the Facebook web service. 

$r=Invoke-WebRequest -Uri ("https://www.facebook.com" + $form.Action) -WebSession $fb -Method POST -Body $form.Fields