...

View Full Version : Embedding Player



Gilligan
12-27-2007, 03:45 PM
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 (http://youku.com) videos.

The typical embed for a video off of there would be


<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


<html>
<head>
<title>Untitled Document</title>
</head>

<body bgcolor="#000000">

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

list(, $data_split) = explode('player.php/sid/', $url, 2);
list($data2, ) = explode('/', $data_split, 2);
$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.

hammer65
12-27-2007, 04:21 PM
When you view the generated source in the browser, what does it look like?

Gilligan
12-27-2007, 04:44 PM
With or without ?url=XODI5MzQwNA at the end?

With: The embedded video is not even displayed

http://img295.imageshack.us/img295/5795/with2tr5.th.jpg (http://img295.imageshack.us/img295/5795/with2tr5.jpg)

Without: Displays as it should.

http://img293.imageshack.us/img293/607/withpp7.th.jpg (http://img293.imageshack.us/img293/607/withpp7.jpg)

Jesuspwnt
12-27-2007, 04:58 PM
<html>
<head>
<title>Untitled Document</title>
</head>

<body bgcolor="#000000">

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

list(, $data_split) = explode('player.php/sid/', $url, 2);
list($data2, ) = explode('/', $data_split, 2);
$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=

hammer65
12-27-2007, 05:06 PM
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.

Gilligan
12-27-2007, 05:26 PM
<html>
<head>
<title>Untitled Document</title>
</head>

<body bgcolor="#000000">

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

list(, $data_split) = explode('player.php/sid/', $url, 2);
list($data2, ) = explode('/', $data_split, 2);
$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.


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


<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>

Jesuspwnt
12-27-2007, 05:32 PM
<html>
<head>
<title>Untitled Document</title>
</head>

<body bgcolor="#000000">

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

list(, $data_split) = explode('player.php/sid/', $url, 2);
list($data2, ) = explode('/', $data_split, 2);
$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

hammer65
12-27-2007, 05:54 PM
Is your PHP distro set up to use short tags? If it isn't you should be using "<?php ?>" instead of "<? ?>".

Gilligan
12-27-2007, 06:35 PM
<html>
<head>
<title>Untitled Document</title>
</head>

<body bgcolor="#000000">

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

list(, $data_split) = explode('player.php/sid/', $url, 2);
list($data2, ) = explode('/', $data_split, 2);
$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

Jesuspwnt
12-27-2007, 09:11 PM
<html>
<head>
<title>Untitled Document</title>
</head>

<body bgcolor="#000000">

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

list(, $data_split) = explode('player.php/sid/', $url, 2);
list($data2, ) = explode('/', $data_split, 2);
$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>

Gilligan
12-27-2007, 09:30 PM
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


<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>

Gilligan
12-28-2007, 06:49 PM
Anyone??????

bphein1980
12-28-2007, 06:57 PM
try removing exit() from the if statement


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

Gilligan
12-28-2007, 09:14 PM
Okay, getting close now. The embed shows up, but nothing in it


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

Gilligan
12-29-2007, 05:35 PM
Any help? I've also noticed that a player appears without me entering ?url=

Gilligan
12-31-2007, 05:54 PM
Anyone??????



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum