Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    New Coder
    Join Date
    Dec 2007
    Posts
    51
    Thanks
    1
    Thanked 1 Time in 1 Post

    Embedding Player

    Can somebody help me, I'm using a code where you can just add part of an URL for an online video, and the PHP code will embed it

    Now i know very little about PHP, but i'm copying another code that someone else used, just changing it a little.

    I want it so that it plays Youku videos.

    The typical embed for a video off of there would be

    Code:
    <embed src="http://player.youku.com/player.php/sid/XODI5MzQwNA==/v.swf" quality="high" width="450" height="372" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"></embed>
    Now I want it so that the user of the PHP powered page simply adds XODI5MzQwNA to the end of an url (http://www.mydomain.com/youkuplayer.php?url=HERE) and then this would embed the video.

    The PHP code i am using is

    PHP Code:
    <html>
    <head>
    <title>Untitled Document</title>
    </head>

    <body bgcolor="#000000">

    <div align="center">
      <?
    $url 
    $_REQUEST['url'];

            list(, 
    $data_split) = explode('player.php/sid/'$url2);
            list(
    $data2, ) = explode('/'$data_split2);
            
    $youkuid $data2;
        

    if (empty(
    $url)) {
        echo 
    '<FONT COLOR="WHITE"><b>Please enter an URL</b><br>';
        echo 
    " - <br>";
        echo 
    " - <br></font>";
        exit();
    }



    if (
    $youkuid != '') {

    if(empty(
    $server)) {

    } else {
    $servid $server;
    }

    $youkuurl 'http://player.youku.com/'.$youkuid.'==/v.swf';

    ?>

      <br>
        
      <embed src="<?=$youkuurl;?>" quality="high" width="450" height="372" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"></embed>
      
      <?
    } else { $error .= "This video could not be found";}
    //-----------------
    ?>
      <br>
      <FONT COLOR="WHITE">
      <b> The above video is hosted by Youku<b><br>
        
      <a href="http://ww.mydomain.com" target="_blank"><img border="0" src="/Images/home.gif"></a><a href="/forum/" target="_blank"><img border="0" src="/Images/forums.gif"></a>
      </FONT>
      <br>
      
       <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
      <script type="text/javascript">_uacct = "UA-2095348-1";urchinTracker();</script>
      </div>

    </body>
    </html>
    This code doesn't play the video.

    Can I have any help?

    Thanks in advance.

  • #2
    Regular Coder
    Join Date
    Dec 2007
    Location
    Nebraska
    Posts
    113
    Thanks
    0
    Thanked 2 Times in 2 Posts
    When you view the generated source in the browser, what does it look like?
    Deliver yesterday, code today, think tomorrow.

  • #3
    New Coder
    Join Date
    Dec 2007
    Posts
    51
    Thanks
    1
    Thanked 1 Time in 1 Post
    With or without ?url=XODI5MzQwNA at the end?

    With: The embedded video is not even displayed



    Without: Displays as it should.


  • #4
    New Coder
    Join Date
    Nov 2007
    Location
    Kent, United Kingdom
    Posts
    67
    Thanks
    6
    Thanked 2 Times in 2 Posts
    PHP Code:
    <html>
    <head>
    <title>Untitled Document</title>
    </head>

    <body bgcolor="#000000">

    <div align="center">
      <?
    $url 
    $_REQUEST['url'];

            list(, 
    $data_split) = explode('player.php/sid/'$url2);
            list(
    $data2, ) = explode('/'$data_split2);
            
    $youkuid $data2;
        

    if (empty(
    $url)) {
        echo 
    '<FONT COLOR="WHITE"><b>Please enter an URL</b><br>';
        echo 
    " - <br>";
        echo 
    " - <br></font>";
        exit();
    }



    if (
    $youkuid != '') {

    if(empty(
    $server)) {

    } else {
    $servid $server;
    }

    $youkuurl 'http://player.youku.com/'.$youkuid.'/v.swf';

    ?>

      <br>
        
      <embed src="<?=$youkuurl;?>" quality="high" width="450" height="372" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"></embed>
      
      <?
    } else { $error .= "This video could not be found";}
    //-----------------
    ?>
      <br>
      <FONT COLOR="WHITE">
      <b> The above video is hosted by Youku<b><br>
        
      <a href="http://ww.mydomain.com" target="_blank"><img border="0" src="/Images/home.gif"></a><a href="/forum/" target="_blank"><img border="0" src="/Images/forums.gif"></a>
      </FONT>
      <br>
      
       <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
      <script type="text/javascript">_uacct = "UA-2095348-1";urchinTracker();</script>
      </div>

    </body>
    </html>
    You see, base64 (the encryption youkid or w/e uses) doesn't always end with ==, so you'd be better off just inserting that into the url. so you'd end up with something like: http://mydomain.com/player.php?watch=SmVzdXM=

  • #5
    Regular Coder
    Join Date
    Dec 2007
    Location
    Nebraska
    Posts
    113
    Thanks
    0
    Thanked 2 Times in 2 Posts
    No not a screen shot, the actual HTML source. You are generating a prortion of your HTML with PHP. If a variable isn't being set or if the short tags that you are using are not working due to ini settings, you may not be getting the URL that you need for the embed tag.

    In your browser, in the view menu, you can view the source code of the page. You will need to use that HTML source to confirm that PHP is writing it's portion of the URL out correctly. If it's not, then that is where your problem is.
    Deliver yesterday, code today, think tomorrow.

  • #6
    New Coder
    Join Date
    Dec 2007
    Posts
    51
    Thanks
    1
    Thanked 1 Time in 1 Post
    Quote Originally Posted by Jesuspwnt View Post
    PHP Code:
    <html>
    <head>
    <title>Untitled Document</title>
    </head>

    <body bgcolor="#000000">

    <div align="center">
      <?
    $url 
    $_REQUEST['url'];

            list(, 
    $data_split) = explode('player.php/sid/'$url2);
            list(
    $data2, ) = explode('/'$data_split2);
            
    $youkuid $data2;
        

    if (empty(
    $url)) {
        echo 
    '<FONT COLOR="WHITE"><b>Please enter an URL</b><br>';
        echo 
    " - <br>";
        echo 
    " - <br></font>";
        exit();
    }



    if (
    $youkuid != '') {

    if(empty(
    $server)) {

    } else {
    $servid $server;
    }

    $youkuurl 'http://player.youku.com/'.$youkuid.'/v.swf';

    ?>

      <br>
        
      <embed src="<?=$youkuurl;?>" quality="high" width="450" height="372" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"></embed>
      
      <?
    } else { $error .= "This video could not be found";}
    //-----------------
    ?>
      <br>
      <FONT COLOR="WHITE">
      <b> The above video is hosted by Youku<b><br>
        
      <a href="http://ww.mydomain.com" target="_blank"><img border="0" src="/Images/home.gif"></a><a href="/forum/" target="_blank"><img border="0" src="/Images/forums.gif"></a>
      </FONT>
      <br>
      
       <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
      <script type="text/javascript">_uacct = "UA-2095348-1";urchinTracker();</script>
      </div>

    </body>
    </html>
    You see, base64 (the encryption youkid or w/e uses) doesn't always end with ==, so you'd be better off just inserting that into the url. so you'd end up with something like: http://mydomain.com/player.php?watch=SmVzdXM=
    Okay i done that.

    Quote Originally Posted by hammer65 View Post
    No not a screen shot, the actual HTML source. You are generating a prortion of your HTML with PHP. If a variable isn't being set or if the short tags that you are using are not working due to ini settings, you may not be getting the URL that you need for the embed tag.

    In your browser, in the view menu, you can view the source code of the page. You will need to use that HTML source to confirm that PHP is writing it's portion of the URL out correctly. If it's not, then that is where your problem is.
    The source code shows no embedded video, nor no PHP code

    Code:
    <html>
    <head>
    <title>Easy-TV .DIVX Player</title>
    </head>
    
    <body bgcolor="#000000">
    
    <div align="center">
        <br>
      <FONT COLOR="WHITE">
      <b> DOUBLE CLICK VIDEO, FOR FULL SCREEN!<b><br>
    
        
      <a href="http://easy-tv.org" target="_blank"><img border="0" src="http://easy-tv.org/Images/home.gif"></a><a href="http://Easy-TV.org/forum/" target="_blank"><img border="0" src="http://easy-tv.org/Images/forums.gif"></a>
      </FONT>
      <br>
      
       <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
      <script type="text/javascript">_uacct = "UA-2095348-1";urchinTracker();</script>
      </div>
    
    </body>
    </html>

  • #7
    New Coder
    Join Date
    Nov 2007
    Location
    Kent, United Kingdom
    Posts
    67
    Thanks
    6
    Thanked 2 Times in 2 Posts
    PHP Code:
    <html>
    <head>
    <title>Untitled Document</title>
    </head>

    <body bgcolor="#000000">

    <div align="center">
      <?
    $url 
    $_REQUEST['url'];

            list(, 
    $data_split) = explode('player.php/sid/'$url2);
            list(
    $data2, ) = explode('/'$data_split2);
            
    $youkuid $data2;
        

    if (empty(
    $url) || trim($url) == '' || trim($youkuid) == ''){
        echo 
    '<FONT COLOR="WHITE"><b>Please enter an URL</b><br>';
        echo 
    " - <br>";
        echo 
    " - <br></font>";
        exit();
    }
    $youkuurl 'http://player.youku.com/'.$youkuid.'/v.swf';

    ?>

      <br>
        
      <embed src="<?=$youkuurl;?>" quality="high" width="450" height="372" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"></embed>
      
      <?
    } else { $error .= "This video could not be found";}
    //-----------------
    ?>
      <br>
      <FONT COLOR="WHITE">
      <b> The above video is hosted by Youku<b><br>
        
      <a href="http://ww.mydomain.com" target="_blank"><img border="0" src="/Images/home.gif"></a><a href="/forum/" target="_blank"><img border="0" src="/Images/forums.gif"></a>
      </FONT>
      <br>
      
       <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
      <script type="text/javascript">_uacct = "UA-2095348-1";urchinTracker();</script>
      </div>

    </body>
    </html>
    try that

  • #8
    Regular Coder
    Join Date
    Dec 2007
    Location
    Nebraska
    Posts
    113
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Is your PHP distro set up to use short tags? If it isn't you should be using "<?php ?>" instead of "<? ?>".
    Deliver yesterday, code today, think tomorrow.

  • #9
    New Coder
    Join Date
    Dec 2007
    Posts
    51
    Thanks
    1
    Thanked 1 Time in 1 Post
    Quote Originally Posted by Jesuspwnt View Post
    PHP Code:
    <html>
    <head>
    <title>Untitled Document</title>
    </head>

    <body bgcolor="#000000">

    <div align="center">
      <?
    $url 
    $_REQUEST['url'];

            list(, 
    $data_split) = explode('player.php/sid/'$url2);
            list(
    $data2, ) = explode('/'$data_split2);
            
    $youkuid $data2;
        

    if (empty(
    $url) || trim($url) == '' || trim($youkuid) == ''){
        echo 
    '<FONT COLOR="WHITE"><b>Please enter an URL</b><br>';
        echo 
    " - <br>";
        echo 
    " - <br></font>";
        exit();
    }
    $youkuurl 'http://player.youku.com/'.$youkuid.'/v.swf';

    ?>

      <br>
        
      <embed src="<?=$youkuurl;?>" quality="high" width="450" height="372" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"></embed>
      
      <?
    } else { $error .= "This video could not be found";}
    //-----------------
    ?>
      <br>
      <FONT COLOR="WHITE">
      <b> The above video is hosted by Youku<b><br>
        
      <a href="http://ww.mydomain.com" target="_blank"><img border="0" src="/Images/home.gif"></a><a href="/forum/" target="_blank"><img border="0" src="/Images/forums.gif"></a>
      </FONT>
      <br>
      
       <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
      <script type="text/javascript">_uacct = "UA-2095348-1";urchinTracker();</script>
      </div>

    </body>
    </html>
    try that
    Parse error: syntax error, unexpected '}' in /PATH/youkuplayer.php on line 31

  • #10
    New Coder
    Join Date
    Nov 2007
    Location
    Kent, United Kingdom
    Posts
    67
    Thanks
    6
    Thanked 2 Times in 2 Posts
    PHP Code:
    <html>
    <head>
    <title>Untitled Document</title>
    </head>

    <body bgcolor="#000000">

    <div align="center">
      <?
    $url 
    $_REQUEST['url'];

            list(, 
    $data_split) = explode('player.php/sid/'$url2);
            list(
    $data2, ) = explode('/'$data_split2);
            
    $youkuid $data2;
        

    if (empty(
    $url) || trim($url) == '' || trim($youkuid) == ''){
        echo 
    '<FONT COLOR="WHITE"><b>Please enter an URL</b><br>';
        echo 
    " - <br>";
        echo 
    " - <br></font>";
        exit();
    }
    $youkuurl 'http://player.youku.com/'.$youkuid.'/v.swf';

    ?>

      <br>
        
      <embed src="<?=$youkuurl;?>" quality="high" width="450" height="372" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"></embed>
      
      <br>
      <FONT COLOR="WHITE">
      <b> The above video is hosted by Youku<b><br>
        
      <a href="http://ww.mydomain.com" target="_blank"><img border="0" src="/Images/home.gif"></a><a href="/forum/" target="_blank"><img border="0" src="/Images/forums.gif"></a>
      </FONT>
      <br>
      
       <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
      <script type="text/javascript">_uacct = "UA-2095348-1";urchinTracker();</script>
      </div>

    </body>
    </html>

  • #11
    New Coder
    Join Date
    Dec 2007
    Posts
    51
    Thanks
    1
    Thanked 1 Time in 1 Post
    This just comes up with

    Please enter an URL
    -
    -
    Even when it isn't blank

    I enter http://URL.com/youkuplayer.php?url=XODI5MzQwNA==

    And all i get is

    Code:
    <html>
    <head>
    <title>Untitled Document</title>
    </head>
    
    <body bgcolor="#000000">
    
    <div align="center">
      <FONT COLOR="WHITE"><b>Please enter an URL</b><br> - <br> - <br></font>

  • #12
    New Coder
    Join Date
    Dec 2007
    Posts
    51
    Thanks
    1
    Thanked 1 Time in 1 Post
    Anyone??????

  • #13
    Regular Coder
    Join Date
    Feb 2005
    Posts
    136
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try removing exit() from the if statement

    PHP Code:
    if (empty($url) || trim($url) == '' || trim($youkuid) == ''){
        echo 
    '<FONT COLOR="WHITE"><b>Please enter an URL</b><br>';
        echo 
    " - <br>";
        echo 
    " - <br></font>";
        exit();


  • #14
    New Coder
    Join Date
    Dec 2007
    Posts
    51
    Thanks
    1
    Thanked 1 Time in 1 Post
    Okay, getting close now. The embed shows up, but nothing in it

    Code:
      <embed src="http://player.youku.com//v.swf" quality="high" width="450" height="372" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"></embed>

  • #15
    New Coder
    Join Date
    Dec 2007
    Posts
    51
    Thanks
    1
    Thanked 1 Time in 1 Post
    Any help? I've also noticed that a player appears without me entering ?url=


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •