You are here: Re: controlling what kind of data is returned by PHP « PHP Programming Language « IT news, forums, messages
Re: controlling what kind of data is returned by PHP

Posted by C. (http://symcbean.blogspot.com/) on 10/03/13 12:00

On 16 Jan, 02:41, The Natural Philosopher <a...@b.c> wrote:
> Paul Lautman wrote:
> > Bint wrote:
> >> This may be an ignorant question, but does PHP always return text
> >> data? I would like to return binary data from a script that I call,
> >> in much the same way that I get binary data simply by downloading a
> >> file. I would like to call a php file and let it determine what
> >> binary data is returned.
> >> Right now, if I try to return a binary string, it seems like the
> >> string is being converted into coded characters , like "%5F" and such
>
> >> Thanks
> >> B
>
> > All data is "binary" data. The browser however interprets the data in
> > different ways depending on the headers that are sent with it. So if the
> > headers say it is an image, the browser will try to display it as an image.
>
> And if it is text, but with odd characters in it, php MAY decide to turn
> that into HTML correct characters, depending on how switches are set I
> think.

? new one on me...try this:

<?php
header('Content-Type: image/gif');
$img=file_get_contents('/some/path/some.gif');
print $img;
?>

C.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация