0

I am sending a simple curl request to a site and im looking into the response page for a specific word. This word is in the top of the page and lets say a little bit down from the <body> tag. In this connection as the curl_getinfo() said, 26.452 bytes are transferred.

So the question is if its possible to stop the transfer of data when e.g the first 1000 bytes (that the key word is included) are received, to make my program working faster.

Thank you

F.N
  • 401
  • 4
  • 21
  • Possible duplicate of http://stackoverflow.com/questions/2032924/how-to-partially-download-a-remote-file-with-curl and http://stackoverflow.com/questions/4955424/can-curl-read-only-first-2000-bytes – Jean-Karim Bockstael Sep 04 '14 at 12:04
  • 1
    I don't think it will speed up your script though, as downloading the content of a page isn't generally the slow part... the slow part is resolving the host, then waiting for the host to generate the content. you may shave a few micro-seconds by aborting the curl-exec mid-download, but to be honest, the if-statement required to check that would counter-act that timesaving anyway.. – RaggaMuffin-420 Sep 04 '14 at 12:07
  • Don't use `curl` but `fsockopen`. – Marek Sep 04 '14 at 12:24

0 Answers0