embeebutterly
12-11-2011, 10:44 PM
Hi guys, i need to retrieve the url created in the following script and embed it in the player below. Here is what i have. You can see how it works (and doesn't) here http://www.brittv.co.uk/template.php?host=brittv-103&stream=skynews.stream_360p
<html>
<head>
<title>...</title>
<?php
$URL_GETKEY="http://www.uktvlive.com/tvc/key.php";
function doCurl($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
$a=doCurl($URL_GETKEY);
$split=explode("<split>",$a);
?>
<script type="text/javascript">
// parse the querystring and create a dictionary of terms for later use:
var qs = [ ]; // where the dictionary goes
if ( location.search.length > 1 )
{
var pairs = location.search.substring(1).split("&");
for ( var p = 0; p < pairs.length; ++p )
{
var pair = pairs[p].split("=");
qs[pair[0]] = unescape( pair[1] );
}
}
// do the replacements *after* page is loaded, for simplicity:
function doReplacements( )
{
var link = document.getElementById("link1");
link.href = "rtsp://81.104.67.230/"+ qs["host"] + "/" + qs["stream"] + "?userID=" + "<?php echo $split[5];?>" + "&accessKey=" + "<?php echo $split[6];?>" + "&sdp=alt&device=mobile";
link.innerHTML = qs["page"];
// and of course you could do any other replacements, too.
}
window.onload = doReplacements;
</script>
</head>
The following part produces the url
<body>
<br/><br/>
<a id="link1">Generic Link</a>
<br/><br/>
Lastly we have the player embed code, this is where im stuck im afraid
<script type="text/javascript">
var url = qs["link1"]; // or whatever name it was passed by
document.write('<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" '
+ ' WIDTH="300" HEIGHT="160" '
+ ' CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">\n'
+ '<PARAM name="SRC" VALUE = "http://www.tvpc.com/images/image1.gif" >\n'
+ '<PARAM name="QTSRC" VALUE = "' + url +'" >\n'
+ '<PARAM name="HREF" VALUE = "' + url + '" >\n'
+ '<PARAM name="AUTOPLAY" VALUE = "true" >\n'
+ '<PARAM name="CONTROLLER" VALUE = "true" >\n'
+ '<PARAM name="TYPE" VALUE = "video/quicktime" >\n'
+ '<PARAM name="TARGET" VALUE = "myself" >\n'
+ '<EMBED \n'
+ ' SRC = "#" \n'
+ ' QTSRC = "' + url + '" \n'
+ ' HREF = "' + url + '" \n'
+ ' TARGET = "myself"\n'
+ ' CONTROLLER = "true"\n'
+ ' WIDTH = "300" \n'
+ ' HEIGHT = "160" \n'
+ ' LOOP = "false" \n'
+ ' AUTOPLAY = "true" \n'
+ ' PLUGIN = "quicktimeplugin" \n'
+ ' TYPE = "video/quicktime" \n'
+ ' CACHE = "false" \n'
+ ' PLUGINSPAGE= "http://www.apple.com/quicktime/download/" >\n'
+ '</EMBED>\n'
+ '</OBJECT>\n'
);
</script>
</body>
</head>
Thanks in advance guys
<html>
<head>
<title>...</title>
<?php
$URL_GETKEY="http://www.uktvlive.com/tvc/key.php";
function doCurl($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
$a=doCurl($URL_GETKEY);
$split=explode("<split>",$a);
?>
<script type="text/javascript">
// parse the querystring and create a dictionary of terms for later use:
var qs = [ ]; // where the dictionary goes
if ( location.search.length > 1 )
{
var pairs = location.search.substring(1).split("&");
for ( var p = 0; p < pairs.length; ++p )
{
var pair = pairs[p].split("=");
qs[pair[0]] = unescape( pair[1] );
}
}
// do the replacements *after* page is loaded, for simplicity:
function doReplacements( )
{
var link = document.getElementById("link1");
link.href = "rtsp://81.104.67.230/"+ qs["host"] + "/" + qs["stream"] + "?userID=" + "<?php echo $split[5];?>" + "&accessKey=" + "<?php echo $split[6];?>" + "&sdp=alt&device=mobile";
link.innerHTML = qs["page"];
// and of course you could do any other replacements, too.
}
window.onload = doReplacements;
</script>
</head>
The following part produces the url
<body>
<br/><br/>
<a id="link1">Generic Link</a>
<br/><br/>
Lastly we have the player embed code, this is where im stuck im afraid
<script type="text/javascript">
var url = qs["link1"]; // or whatever name it was passed by
document.write('<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" '
+ ' WIDTH="300" HEIGHT="160" '
+ ' CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">\n'
+ '<PARAM name="SRC" VALUE = "http://www.tvpc.com/images/image1.gif" >\n'
+ '<PARAM name="QTSRC" VALUE = "' + url +'" >\n'
+ '<PARAM name="HREF" VALUE = "' + url + '" >\n'
+ '<PARAM name="AUTOPLAY" VALUE = "true" >\n'
+ '<PARAM name="CONTROLLER" VALUE = "true" >\n'
+ '<PARAM name="TYPE" VALUE = "video/quicktime" >\n'
+ '<PARAM name="TARGET" VALUE = "myself" >\n'
+ '<EMBED \n'
+ ' SRC = "#" \n'
+ ' QTSRC = "' + url + '" \n'
+ ' HREF = "' + url + '" \n'
+ ' TARGET = "myself"\n'
+ ' CONTROLLER = "true"\n'
+ ' WIDTH = "300" \n'
+ ' HEIGHT = "160" \n'
+ ' LOOP = "false" \n'
+ ' AUTOPLAY = "true" \n'
+ ' PLUGIN = "quicktimeplugin" \n'
+ ' TYPE = "video/quicktime" \n'
+ ' CACHE = "false" \n'
+ ' PLUGINSPAGE= "http://www.apple.com/quicktime/download/" >\n'
+ '</EMBED>\n'
+ '</OBJECT>\n'
);
</script>
</body>
</head>
Thanks in advance guys