Skip to content

Commit ae2e8af

Browse files
committed
Merge branch '4.3' into 4.4
* 4.3: Replace references to Goutte with HttpBrowser
2 parents caecbec + 23ddd7d commit ae2e8af

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

components/browser_kit.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ This method accepts a request and should return a response::
5959
}
6060

6161
For a simple implementation of a browser based on the HTTP layer, have a look
62-
at `Goutte`_. For an implementation based on ``HttpKernelInterface``, have
63-
a look at the :class:`Symfony\\Component\\HttpKernel\\Client` provided by
64-
the :doc:`HttpKernel component </components/http_kernel>`.
62+
at the :class:`Symfony\\Component\\BrowserKit\\HttpBrowser` provided by
63+
:ref:`this component <component-browserkit-external-requests>`. For an implementation based
64+
on ``HttpKernelInterface``, have a look at the :class:`Symfony\\Component\\HttpKernel\\Client`
65+
provided by the :doc:`HttpKernel component </components/http_kernel>`.
6566

6667
Making Requests
6768
~~~~~~~~~~~~~~~

components/dom_crawler.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -618,23 +618,26 @@ of the information you need to create a POST request for the form::
618618

619619
// now use some HTTP client and post using this information
620620

621-
One great example of an integrated system that uses all of this is `Goutte`_.
622-
Goutte understands the Symfony Crawler object and can use it to submit forms
621+
One great example of an integrated system that uses all of this is
622+
the :class:`Symfony\\Component\\BrowserKit\\HttpBrowser` provided by
623+
the :doc:`BrowserKit component </components/browser_kit>`.
624+
It understands the Symfony Crawler object and can use it to submit forms
623625
directly::
624626

625-
use Goutte\Client;
627+
use Symfony\Component\BrowserKit\HttpBrowser;
628+
use Symfony\Component\HttpClient\HttpClient;
626629

627630
// makes a real request to an external site
628-
$client = new Client();
629-
$crawler = $client->request('GET', 'https://github.com/login');
631+
$browser = new HttpBrowser(HttpClient::create());
632+
$crawler = $browser->request('GET', 'https://github.com/login');
630633

631634
// select the form and fill in some values
632635
$form = $crawler->selectButton('Sign in')->form();
633636
$form['login'] = 'symfonyfan';
634637
$form['password'] = 'anypass';
635638

636639
// submits the given form
637-
$crawler = $client->submit($form);
640+
$crawler = $browser->submit($form);
638641

639642
.. _components-dom-crawler-invalid:
640643

@@ -659,5 +662,4 @@ Learn more
659662
* :doc:`/testing`
660663
* :doc:`/components/css_selector`
661664

662-
.. _`Goutte`: https://github.com/FriendsOfPHP/Goutte
663665
.. _`html5-php library`: https://github.com/Masterminds/html5-php

0 commit comments

Comments
 (0)