更新时间:2023-02-23 14:13:00
If the server supports it, you can make a range request.
Add, to your HTTP request headers:
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Range: 0-1500',
));
… to get the first 1500 bytes, which may or may not be the first ten lines, depending on how long the lines are.
The problem with this (aside from possible lack of support by the server) is that you need to know which bytes in the document you want and then you have to extract the data from a partial HTML instead of a complete HTML document.