Php to return a binary not html
Im writing a script that when contacted dynamically reads in certain files and returns the text on the screen as html but i also need to have the option that if someone contacts the server with the url string binary=true then the php script should read those file and return them as a binary(download) . Any one know how i can do this?
|
I've done something like this to create images that are created "on the fly" by using something like:
header("Content-type: image/jpeg"); That lets the browser know that you are returning a type other than text/html so that it can handle it appropriately. You can then just print out the binary you need. |
Code:
<?php |
cool the changing the content type was what i was trying to do the only problem with that is that it returns the file as index.php, although hko your idea is probably pretty good to i could create a temporary file and then forward them to that, just not sure it will work with the client (its a game running on cellphone) thanks guys
|
All times are GMT -5. The time now is 09:39 AM. |