Как войти в facebook с помощью goutte в laravel

Я хочу войти в Facebook, используя goutte в laravel. Это документ для входа в github, но я хочу войти в facebook и получить все имена людей, доступных на странице. Что я пытаюсь

$crawler = $client->request('GET', 'https://www.facebook.com');
    $form = $crawler->selectButton('Log In')->form();

    $crawler = $client->submit($form, array('email' => 'fabpot', 'pass' => 'xxxxxx'));
    // submit that form
    $crawler = $client->submit($form);
    echo $crawler->html();

    return $this->render('scraperBundle:Thing:index.html.twig');

Но я получаю ошибку:

InvalidArgumentException in Crawler.php line 822:
The current node list is empty.

Пожалуйста, помогите мне.


person Glenda E Alvarez    schedule 21.06.2016    source источник


Ответы (1)


Попробуйте это будет работать

$client = new Client();
$crawler = $client->request('GET', 'https://en-gb.facebook.com/login/');
$form = $crawler->selectButton('Log In')->form();
$crawler = $client->submit($form, array('email' => 'email', 'pass' => 'pass'));
$crawler->filter('.flash-error')->each(function ($node) {
    print $node->text()."\n";
});
echo $crawler->html();
person Aman Kumar    schedule 21.06.2016