reactjs - 没有为反应页面设置powershell invoke-webrequest websession?
问题描述
我尝试在访问反应页面时设置会话。在下面的示例代码中,我以 facebook 为例
$url = "https://facebook.com"
$webrequest = Invoke-WebRequest -Uri $url -SessionVariable websession
Write-Output $websession
$cookies = $websession.Cookies.GetCookies($url)
# Here, you can output all of $cookies, or you can go through them one by one.
foreach ($cookie in $cookies) {
# You can get cookie specifics, or just use $cookie
# This gets each cookie's name and value
Write-Host "$($cookie.name) = $($cookie.value)"
}
(脚本取自https://gallery.technet.microsoft.com/scriptcenter/Getting-Cookies-using-3c373c7e)
这不会输出任何 cookie,尽管 FB 会发送 cookie,正如我在浏览器的开发者控制台中看到的那样。如果我在 google.ch 上运行这个脚本,它就可以工作。我还尝试了另一个反应页面,但又一次......不起作用。我在这里缺少什么?
此致
解决方案
推荐阅读
- ios - Swift:如何将 Decodable.Protocol 对象保存到变量中?
- python - 在 Tkinter 上更改主循环内显示的图像?
- python - 您如何动态地为按钮列表分配相同的功能但不同的参数?
- gdi+ - 仅以灰度渲染到 GDI+
- powershell - 在最后一个终止后启动新的进程实例,或者如何更新 $timer.add_tick 方法
- schema.org - LD+JSON - 用于产品的 SameAs
- java - 在java中将数字打印为三角形
- android - Android Studio:在后台访问本地 WiFi 链接
- node.js - 如何使用nodejs截取文件内容的屏幕截图?
- spring-boot - Web Sphere 应用服务器上的过滤器 springSecurityFilterChain 引发的未捕获异常