|
-
May 8th, 2006, 09:20 PM
#1
Thread Starter
Frenzied Member
How to check for media player using HTTP_USER_AGENT
Hi all i want to write a php script that if only the request came from media player it work other wise it gives an error massage .for example if the request came from get or post or direct url execution in browser addrres i want it to send error message. I be happy if some one show me how to check for media players. I just do not know how to check for agent.Thanks
Code:
if($_SERVER['HTTP_USER_AGENT']=="your_user_agent")
{
//load your file
}
else
{
//load the error message
}
-
May 9th, 2006, 01:59 AM
#2
Re: How to check for media player using HTTP_USER_AGENT
Using the user agent field is always a bit flaky, but you could try this
PHP Code:
$ua = $_SERVER['HTTP_USER_AGENT'];
if (strpos($ua, 'Windows-Media-Player') || strpos($ua, 'NSPlayer')) {
// Windows Media Player
}
else if (strpos($ua, 'RealMedia')) {
// RealPlayer
}
I don't know of any more unfortunately.
-
May 9th, 2006, 02:11 AM
#3
Thread Starter
Frenzied Member
Re: How to check for media player using HTTP_USER_AGENT
Thank u for u reply. Do u think the is the way they write it with - and no space ?The reason that i ask that my php be able to check for correct names. Furtheremore, could i us protocol in the same way ? for example http RealMedia file.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|