symfony-panther - 如何在外部网站上使用 Panther 登录?
问题描述
我使用 symfony/panther 进行网络爬取。要访问我想要的页面,我需要经过身份验证,但我不知道该怎么做。
我努力了 :
$client = Client::createChromeClient();
$client->start();
$crawler = $client->request('GET', 'http://website.com/login.php');
$form = $crawler->selectButton('Submit!')->form([
'email' => myEmail,
'pwd' => myPassword
]);
$client->submit($form);
但它不起作用,我的用户没有经过身份验证。
我想我需要检索一个 cookie 并将其添加到我的客户端,但我不知道该怎么做。有人可以给我执行此操作的步骤吗?
解决方案
推荐阅读
- r - R:如何制作单变量散点图?
- php - MySQL SELECT 有时即使存在也什么也找不到
- cassandra - 卡桑德拉墓碑跨越门槛
- python - 如何正确地将嵌套数组(均为 1D)数组重塑为 2D 数组以适合我的 Keras 模型?
- android - Is there a way to compare a list of values with a SQLite table?
- kotlin - 为什么我可以在 Kotlin 中将 MutableList 实例化为 val(并向其中添加元素)?
- sql - 你如何让查询每次都返回一个特定的值
- angular - Ionic Web Builder 找不到离子模块?
- c# - 将列表转换为列表
在 c# 中无需 foreach 即可有效 - optaplanner - 使用 subChainChangeMoveSelector 或 subChainSwapMoveSelector 进行附近选择