我对Goutte提交表单有一些问题。我尝试登录应用程序,但每次刷新时都返回404错误,但在应用程序中返回404,因为作为最终结果,我将返回html()以查看发生了什么。可能是404,因为我的链接是ex。
http://localhost:8000/trylogin下面是代码。
$client = new Client();
$crawler = $client->request('GET', 'https://app.productlistgenie.io/signin');
$form = $crawler->selectButton('LogIn')->form();
$crawler = $client->submit($form, array('email' => 'myemail@here.com', 'password' => 'mypasshere'));
$crawler->filter('.flash-error')->each(function ($node) {
print $node->text()."\n";
});
return $crawler->html();发布于 2020-02-14 19:47:47
这是工作代码
$client = new Client();
$crawler = $client->request('GET', 'https://app.productlistgenie.io/signin');
$form = $crawler->selectButton('SIGN IN')->form();
$crawler = $client->submit($form, array('email' => 'myemail@here.com', 'password' => 'mypasshere'));
$crawler->filter('.font-roboto-light.color-dark-white')->each(function ($node) {
print $node->text()."\n";
});
return $crawler->html();https://stackoverflow.com/questions/56317090
复制相似问题