Alright.. I made the following php file to do permalinks to my videos:
<?php
// get the file
$serverrequesturi= $_SERVER['REQUEST_URI'];
$serverphpself= $_SERVER['PHP_SELF'];
$find[] = $serverphpself.'/';
$replace[] = '';
$requestfilename = str_replace($find, $replace, $serverrequesturi);
// here is where I could gather stats or redirect to mirrors
header("Location: http://billshackelford.com/video/$requestfilename");
?>
I saved it as getmedia.php5 on my server and my links to videos in my podcast
will look
like this:
http://billshackelford.com/getmedia/linuxppc.m4v
Does anyone see anything that I have done that will not work with iTunes/iPod
or anything
else?
Thanks!
- Bill Shackelford
http://billshackelford.com
--- In [email protected], "billshackelford" <[EMAIL PROTECTED]>
wrote:
>
> Great.. I will try to plug this into my site. :)
>
>
>
> --- In [email protected], "Andreas Haugstrup Pedersen"
> <solitude@>
> wrote:
> >
> > You're right of course. I got things messed up in my head (thinking of the
> > case where you'd pipe a file through readfile()). That'll teach me to act
> > smart. :o)
> >
> > - Andreas
> >
> > Den 23.01.2007 kl. 15:49 skrev Mike Hudack <mike@>:
> >
> > > Andreas, you don't need to set Content-type to "video/mpg," in fact I
> > > believe that doing so is destructive.
> > >
> > > The actual content returned in the redirect response is either
> > > text/plain or text/html, and NOT video/mpg. When the browser follows
> > > the redirect and requests the actual video file it will receive the
> > > proper content-type from the server, presumably video/mpg. If you set
> > > your redirect response to video/mpg and send it to a browser that
> > > doesn't support redirects for some odd reason the user is going to get a
> > > really weird looking page, maybe even a video player without a video.
> > >
> > > So don't set the content type explicitly. PHP or Apache will handle
> > > this for you, returning either text/html or text/plain depending on the
> > > format of the "The file you have requested has temporarily moved to..."
> > > message.
> > >
> > > Yours,
> > >
> > > Mike
> > >
> > >> -----Original Message-----
> > >> From: [email protected]
> > >> [mailto:[EMAIL PROTECTED] On Behalf Of Andreas
> > >> Haugstrup Pedersen
> > >> Sent: Tuesday, January 23, 2007 9:10 AM
> > >> To: [email protected]
> > >> Subject: Re: [videoblogging] Permalinks and download
> > >> tracking? How do I do that?
> > >>
> > >> Your syntax is spot on. It's only lacking one crucial thing.
> > >> Per default PHP is sent as text/html so along with the
> > >> Location header you need to send the correct content-type
> > >> header (to build on your example):
> > >>
> > >> header('Content-type: video/mpg');
> > >> header('Location: '.$videos[$_GET['video']]);
> > >>
> > >> And since Mike was writing pseudocode you also need to add
> > >> your own input checking (e.g. throw a 404 if the video isn't
> > >> found) and so on.
> > >>
> > >> As Mike demonstrated the difficult bit is not sending the
> > >> headers. It's deciding what kind of stats you want to save
> > >> and then building the database scripts to deal with it.
> > >>
> > >> - Andreas
> > >>
> > >> Den 23.01.2007 kl. 14:47 skrev Mike Hudack <mike@>:
> > >>
> > >> > Hey Bill,
> > >> >
> > >> > This is indeed pretty easy to do. We do it for a number of
> > >> reasons,
> > >> > from collecting statistical information to finding the most
> > >> > appropriate server to deliver the video from, which means that our
> > >> > code for doing this is pretty complicated. Your code can
> > >> probably be much simpler.
> > >> >
> > >> > I'm not really a php programmer (I'm more of a perl guy), but this
> > >> > kind of form should work for you assuming you have a call style like
> > >> > http://mywebsite.com/video.php?video=bar.mpg:
> > >> >
> > >> > <?php
> > >> > $videos['foo.mpg'] = 'http://bar.baz/foo.mpg';
> > >> > $videos['bar.mpg'] = 'http://foo.baz/bar.mpg';
> > >> >
> > >> > // Do what you want to collect data, et cetera
> > >> >
> > >> > header('Location: ' . $videos[$_GET['video']]; ?>
> > >> >
> > >> > You should probably consider this pseudo code and not actual code,
> > >> > since my recollection of php syntax and variable instantiation is
> > >> > pretty rusty. One thing to keep in mind is that you cannot output
> > >> > anything from your php script prior to calling the header()
> > >> function
> > >> > -- if it isn't the first thing you call that produces output your
> > >> > script will break with an ugly HTML Web page with a big bold error
> > >> > message in the middle of it.
> > >> >
> > >> > Yours,
> > >> >
> > >> > Mike
> > >> > Co-founder & CEO, blip.tv
> > >> >
> > >> >> -----Original Message-----
> > >> >> From: [email protected]
> > >> >> [mailto:[EMAIL PROTECTED] On Behalf Of billshackelford
> > >> >> Sent: Tuesday, January 23, 2007 12:39 AM
> > >> >> To: [email protected]
> > >> >> Subject: [videoblogging] Permalinks and download tracking?
> > >> >> How do I do that?
> > >> >>
> > >> >> Blip.tv has permalinks like this:
> > >> >>
> > >> >> http://blip.tv/file/get/Bshack-PopPopPop659.m4v
> > >> >>
> > >> >> When you click on it, it will redirect to the actual file
> > >> location.
> > >> >> When it redirects it also gathers information about you for stats.
> > >> >> The above link will work in itunes even with the redirects.
> > >> >>
> > >> >> How do they do that? I could I do that with PHP?
> > >> >>
> > >> >>
> > >> >>
> > >> >>
> > >> >> Yahoo! Groups Links
> > >> >>
> > >> >>
> > >> >>
> > >> >>
> > >>
> > >>
> > >>
> > >> --
> > >> Andreas Haugstrup Pedersen
> > >> <URL: http://www.solitude.dk/ >
> > >>
> > >>
> > >>
> > >> Yahoo! Groups Links
> > >>
> > >>
> > >>
> > >>
> >
> >
> >
> > --
> > Andreas Haugstrup Pedersen
> > <URL: http://www.solitude.dk/ >
> >
>