Results 1 to 3 of 3

Thread: How to check for media player using HTTP_USER_AGENT

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    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 
    }

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    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
  •  



Click Here to Expand Forum to Full Width