Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>A simpler way (without creating your own data chunks) is to only use flush():</p> <pre><code>&lt;?php $fp = fopen('data.bin', "rb"); flush(); fpassthru($fp); ?&gt; </code></pre> <p>This worked for me as shown in the following HTTP request and response.</p> <p>Request:</p> <pre><code>00000000 47 45 54 20 2f 67 65 74 2d 63 68 75 6e 6b 2e 70 GET /get -chunk.p 00000010 68 70 20 48 54 54 50 2f 31 2e 31 0d 0a 55 73 65 hp HTTP/ 1.1..Use 00000020 72 2d 41 67 65 6e 74 3a 20 63 75 72 6c 2f 37 2e r-Agent: curl/7. 00000030 32 31 2e 37 20 28 69 36 38 36 2d 70 63 2d 6c 69 21.7 (i6 86-pc-li 00000040 6e 75 78 2d 67 6e 75 29 20 6c 69 62 63 75 72 6c nux-gnu) libcurl 00000050 2f 37 2e 32 31 2e 37 20 4f 70 65 6e 53 53 4c 2f /7.21.7 OpenSSL/ 00000060 31 2e 30 2e 30 64 20 7a 6c 69 62 2f 31 2e 32 2e 1.0.0d z lib/1.2. 00000070 35 20 6c 69 62 73 73 68 32 2f 31 2e 32 2e 37 0d 5 libssh 2/1.2.7. 00000080 0a 48 6f 73 74 3a 20 67 61 69 61 0d 0a 41 63 63 .Host: g aia..Acc 00000090 65 70 74 3a 20 2a 2f 2a 0d 0a 0d 0a ept: */* .... </code></pre> <p>Response:</p> <pre><code>00000000 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d HTTP/1.1 200 OK. 00000010 0a 44 61 74 65 3a 20 54 68 75 2c 20 32 32 20 53 .Date: T hu, 22 S 00000020 65 70 20 32 30 31 31 20 32 33 3a 35 33 3a 30 32 ep 2011 23:53:02 00000030 20 47 4d 54 0d 0a 53 65 72 76 65 72 3a 20 41 70 GMT..Se rver: Ap 00000040 61 63 68 65 2f 32 2e 32 2e 38 20 28 46 65 64 6f ache/2.2 .8 (Fedo 00000050 72 61 29 0d 0a 58 2d 50 6f 77 65 72 65 64 2d 42 ra)..X-P owered-B 00000060 79 3a 20 50 48 50 2f 35 2e 32 2e 36 0d 0a 54 72 y: PHP/5 .2.6..Tr 00000070 61 6e 73 66 65 72 2d 45 6e 63 6f 64 69 6e 67 3a ansfer-E ncoding: 00000080 20 63 68 75 6e 6b 65 64 0d 0a 43 6f 6e 74 65 6e chunked ..Conten 00000090 74 2d 54 79 70 65 3a 20 74 65 78 74 2f 68 74 6d t-Type: text/htm 000000A0 6c 3b 20 63 68 61 72 73 65 74 3d 55 54 46 2d 38 l; chars et=UTF-8 000000B0 0d 0a 0d 0a .... 000000B4 61 0d 0a 54 45 53 54 20 44 41 54 41 0a 0d 0a 30 a..TEST DATA...0 000000C4 0d 0a 0d 0a .... </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload