如何通过 Windows CMD 向远程 API 发送 HTTP 请求?例如
http://example.com/api/1
Run Code Online (Sandbox Code Playgroud)
将返回一个 JSON 对象。
我已经看到了一些有用的工具,比如 cURL for windows,但如果可能的话,我想避免为此安装任何 3rd 方软件。另外,我想要的是发送请求,并将响应保存为 .txt 文件(称为 resp.txt)
小智 5
我知道在 powershell 中,更好的窗口命令行工具,您可以执行以下操作。
$client = new-object System.Net.WebClient
$client.DownloadFile("http://example.com/anything.here", "C:\tmp\FROMNET.txt")
Run Code Online (Sandbox Code Playgroud)
在命令行中,我认为除非您安装 3rd 方工具,否则这是不可能的
|   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           7537 次  |  
        
|   最近记录:  |