Login and submit form with web-crawler

2019-09-16 11:20发布

问题:

So in web-crawler I pass and submit data like this

$client = new Client();
$crawler = $client->request('GET', 'link');
$form = $crawler->filter('.default')->form();
$crawler = $client->submit($form, array(
            'login'=>'ud',
            'password'=>'pw'

));

But if I use var_dump($crawler); I realise that I never get data from the website after login because it redirects me and var_dump takes data from the page where I submited.

I want after login to move to the new link to submit a form

$client->followRedirects(true);

redirects me to the new page but I can't find a way to submit there because I can't select the form nth-child but doesn't work

I use Goutte and php 7