header information

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

header information

Post by kendall »

Hi,

I didnt no where to post this so if some one has an appropirate place...thanks

My question deals with using the header() to output content type based on a filename in php

now i no header(Content Type: text/html) is fo HTML
and header(Content Type: image/jpeg) is fo JPEG

but is there something 'standard' that can be used to header() whether its jpeg, gif, html, php , text, swf, a g-string thong, or a nut?
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

i don't think so, because text is text and binary is binary
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Actually, text/html? Does that exists really?

Anyways, http://www.cis.ohio-state.edu/cgi-bin/rfc/rfc1494.html
Perhaps you will find more info there.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

[big_search]mime types[/big_search]
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

wow Sami, you really love these new forum features don't you? :P
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Oh yeah. 8)
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post by kendall »

What about .swf files

are the image/swf or text/swf

KEndall
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

kendall wrote:What about .swf files

are the image/swf or text/swf

KEndall
SWF files are application/x-shockwave-flash
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post by kendall »

Gen,

Goosh!!!! this is even harder than i thought...

I wanted to build an advertisement system that will display images, html or swf files.

I thought i would have been as simple as a header() or an include but dang this is getting really far ahead of me

Kendall
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

include ("$filename");

whats wrong with that?
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

LiLpunkSkateR wrote:include ("$filename");

whats wrong with that?
When i think of adverts (and PHP combined) I think of the earlier discussions there have been using:
<img src="http://www.example.com/advertisment.php?id=23" />

advertisment.php is a script, that takes the id and returns 'something' based on that. If id 23 points to a .jpg, the script needs to send the correct headers for the image to show.

Take Jason's avatar on this forum. That avatar is really a random image generator script, working basicly the same way. Using include('file') will not work in this case.

If this is kendall's case, I do not know, but at least I might have shared some light on the subject. ;)
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post by kendall »

JAM,

well i wish it was as simple as jpeg images well it cud be but im exploring the use of html and swf as advertisement files so i was researching options for using html headers and swf headers but the headers for these
are very different so im thinking i have to do some conditioning...just wanted to know what people do in these cases
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

so why not just have the person using your advertising service go:

Code: Select all

&lt;?PHP include ("http://www.example.com/script.php?id=4858") ?&gt;
and on script.php have something that randomly picks and displays it using the correct tags

Code: Select all

<?PHP 
display[0] = <img src="http://www.example.com/pic.gif">;
display[1] = <img src="http://www.example.com/pic2.jpg">;
display[2] = <flash tags = "http://www.example.com/flash.swf">;
display[3] = <a href="http://www.example.com/redirect.php?link=39">;

echo $display[random];
?>

sorry if im totally off base, but this is my first time trying something like this and it seems like it should work..
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post by kendall »

lilPnuk,

Im using a database with a click stat position and stuff...sometimes i ask myself...why do i make things so hard...then i tell my self....because im an idiot...we do thing the hard way :D

even if i include i would have to do a number of header() combinations but i was also catering for a non-php world so i rezorted to using <script src="file.php"> scenario which would have allowed me to document.write the result but that has grown more difficult

i think im gonna go with the include i jus have to find the rite method of diaplying based on the type of file...
believe it or not there is a mime_content_type() that cud have solved my issues but gosh DARN it my IHP's have screwe me...again.

yes things are jus F@#! up wid me today

going and have a beer [henikin]
later

Kendall
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

kendall wrote: going and have a beer [henikin]
later

Kendall
Can't... resist... replying...
But spelling Heiniken as henikin tells me that you allready had one or fifteen allready :wink:
Post Reply