Log in

View Full Version : window media file



tzinyii
09-19-2006, 04:00 AM
Hi,

http://www.conversysinternational.com.au/mytv/index.php?channel=test

I'd like to use php code to stream a window media file similar to the one above. I am still a newbie in PHP. Could someone advise on the php code ($_GET array?) used above?

Thanks and best regards,
Tzinyii

djr33
09-20-2006, 12:41 AM
that's strange.

Basically, that takes the get variables from the url then passes them on to the src for the embedded wmv object.

the SRC becomes:
http://www.conversysinternational.com.au/mytv/channelload.php?channel=test
(that's the absolute url, though it's relative in the source code)

But if you load that, it forwards you to a page that simply says:
"Ram Sharan Khakurel Ram Sharan Khakurel" which (see below) appears to be the name of the author of the page.

Basically, that's just a way to stop people from downloading and it seems to work well.

Without looking at it further, I can't tell you exactly what's going on.


As for $_GET variables, it's quite easy to use them, but this specific case goes way beyond that. It just passes the value $_GET['channel'] to the src which is then another php page which likely chooses a movie based on that $_GET value. Again, nothing complex.
The complex part is everything around that that's stopping you from downloading/viewing/etc.



Note: the source code for the page you are redirected to is strange. Since it's a "test", as it seems by the channel=test, that might explain why it won't load... there is nothing to load.
Here's the source code for that page--

<asx version = "3.0">
<title>test video clip</title>
<entry>
<ref href = "http://conversysinternational.com.au/mytv/metafile/So32v64-100k.wmv"/>
<title>test video clip</title>
<copyright>Ram Sharan Khakurel</copyright>
<author>Ram Sharan Khakurel</author>
</entry>

</asx>
And now, I just found the video... it's in that source:
http://conversysinternational.com.au/mytv/metafile/So32v64-100k.wmv

Apparently, wm player looks for the <ref href=""> and goes by that.

Anyway, that's your video.

Likely, it just stores the url for that video in a database, and then relates that to the code "test", where the code "something" might be fklajklsd.wmv, etc.
It's just a way to keep the real file a few levels down so people can't easily download it.

tzinyii
09-20-2006, 01:40 AM
Thanks a lot for your input.
I noticed that on the main file itself, the author uses:
<form action =post><input type=hidden value="1"></form>
<PARAM NAME="fileName" VALUE="channelload.php?channel=test">
I tested using the above code for the main file
and for the "channelload.php", I tried using the codes below but it doesn't work.

<?php
echo $_POST["channel=test"];
?>
Do you know how the codes should be rewritten?

djr33
09-20-2006, 05:22 AM
The first line of what you posted doesn't do anything... I don't really understand it. There's no name to the form and no name to the hidden field with a value of 1, so that can't affect anything...
As for the PARAM NAME, that's the same as the SRC for the object, as I mentioned above.

I don't understand what you are trying to do with the code you wrote.

GET and POST variables have names and values. The name of the field (and/or the name of the variable in the url, like ?name=value) is what you use inside the brackets, and the value is what is output from that.

If the url is: ?name=value
and your php is:
echo $_GET['name'];
your output would be "value".

POST variables work the same way. The name is in the array thing, the brackets, and the output is the value of that part of the POST array.

If you want to output "test" then your code would be echo $_POST['channel'];, assuming that the value of that was test, as determined by the preview form, etc.

However, note that GET variables are in the URL and are usually sent by a form, though they can be just used in the url too.
POST varialbes, on the other hand, can only be send by forms*, and don't appear in the URL. According to the page in question, we're talking about GET variables, not POST.
(*There are complex other methods of sending post variables, but they're not relevant. [some ways include using a flash object or complex ajax (a form of javascript).])

To be honest, you're clearly pretty new to some of this, and I'd just like to make it clear that dealing with the GET and/or POST variables is the least of your concerns, considering the rest of the coding, such as generating the page that is used as the src.
Don't get discouraged, though.

Really, you should just take a look at the info available at php.net.