@@ -582,23 +582,26 @@ of the information you need to create a POST request for the form::
582
582
583
583
// now use some HTTP client and post using this information
584
584
585
- One great example of an integrated system that uses all of this is `Goutte `_.
586
- Goutte understands the Symfony Crawler object and can use it to submit forms
585
+ One great example of an integrated system that uses all of this is
586
+ the :class: `Symfony\\ Component\\ BrowserKit\\ HttpBrowser ` provided by
587
+ the :doc: `BrowserKit component </components/browser_kit >`.
588
+ It understands the Symfony Crawler object and can use it to submit forms
587
589
directly::
588
590
589
- use Goutte\Client;
591
+ use Symfony\Component\BrowserKit\HttpBrowser;
592
+ use Symfony\Component\HttpClient\HttpClient;
590
593
591
594
// makes a real request to an external site
592
- $client = new Client( );
593
- $crawler = $client ->request('GET', 'https://github.com/login');
595
+ $browser = new HttpBrowser(HttpClient::create() );
596
+ $crawler = $browser ->request('GET', 'https://github.com/login');
594
597
595
598
// select the form and fill in some values
596
599
$form = $crawler->selectButton('Sign in')->form();
597
600
$form['login'] = 'symfonyfan';
598
601
$form['password'] = 'anypass';
599
602
600
603
// submits the given form
601
- $crawler = $client ->submit($form);
604
+ $crawler = $browser ->submit($form);
602
605
603
606
.. _components-dom-crawler-invalid :
604
607
@@ -623,5 +626,4 @@ Learn more
623
626
* :doc: `/testing `
624
627
* :doc: `/components/css_selector `
625
628
626
- .. _`Goutte` : https://github.com/FriendsOfPHP/Goutte
627
629
.. _`html5-php library` : https://github.com/Masterminds/html5-php
0 commit comments