Headers are automatically included, and by default the Content-type is text/html (from the browser's point of view), so you will have to start out by using the header() function to send an appropriate Content-type line for the type of binary data you're sending.
To send the binary data, use fopen(), fpassthru(), and fclose().