'Get raw HTML code of element with Symfony DomCrawler

Html structure:

   <div id="product">
     <p>some text</p>
     <p>some text2</p>
   </div>    

My PHP code:

$client = new Client();
$crawler = $client->request('GET', $url);
echo $crawler->filter('#product')->text();

returns:

some text some text2

But I need:

<p>some text</p>
<p>some text2</p>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source