How to rob from tag to tag with cURL

Given code:

$ch = curl_init("" . (int)$_GET['id']);
curl_setopt($ch, CURLOPT_USERAGENT, "Opera/9.63 (Windows NT 5.1; U; ru) Presto/2.1.1");

How to make a hornbeam in cURL?
For example, to rob from the <body>tag to </body>, or at least “from such and such” line to “such and such”.

Or is it possible in file_get_contents– to indicate which browser you are currently using? ( For example Opera/9.63 (Windows NT 5.1; U; ru) )

Dear coders! Help me please! 🙁

Answer 1, authority 100%

Answer in topic Grab question

Answer 2, authority 100%

Pulls out all links from the site:

preg_match_all('#<a.*?href="(.+?)".*?>(.+?)</a>#is', $without_other_tags, $text, PREG_PATTERN_ORDER);
#$without_other_tags -  
#$text -   

Answer 3

You apparently need to merge part of the file (from and to) it is possible to implement it with sockets, you cannot specify a browser in file_get_contents(), again you can use a socket.