Add video/Audio url of live streaming in mp media player - php

I need to add url of video/audio to a player on my website.
For Example: I got this code from the "src" of an embed tag
http://www.ndtv.com/common/videos/flash/player/new-wrapper/NDTVVideoPlayer.swf?1384167757
And it did not work.
Please suggest how to get the proper URL,
The media Player is 'MP Plyaer'

Embed your SWF like this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Embed SWF</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("http://www.ndtv.com/common/videos/flash/player/new-wrapper/NDTVVideoPlayer.swf?1384167757", "myContent", "300", "120", "9.0.0");
</script>
</head>
<body>
<div id="myContent">
<p>NDTV SWF</p>
</div>
</body>
</html>

Related

Php in HTML doesn't work

Look, i have html with included php link but that doesn't work well.Information what was in html doesn't come to php page. Please help with that.
HTML CODE:
<!DOCTYPE html PUBLIC "-//W3C//DTD
➝ XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/
➝ DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/
➝ 1999/xhtml" xml:lang="en"
➝ lang="en">
<head>
<meta http-equiv="Content-Type"
➝ content="text/html;
➝ charset=utf-8"/>
<title>Greetings!</title>
</head>
<body>
<!-- Script 3.6 - hello.html -->
<div><p>Click a link to say
➝ hello:</p>
<ul>
<li><a href="hello.php?
name=Michael">Michael</a></li>
<li><a href="hello.php?
name=Celia">Celia</a></li>
<li><a href="hello.php?
name=Jude">Jude</a></li>
<li><a href="hello.php?
name=Sophie">Sophie</a></li>
</ul>
</div>
</body>
</html>
PHP code:
<!DOCTYPE html PUBLIC "-//W3C//DTD
➝ XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/
➝ DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/
➝ 1999/xhtml" xml:lang="en"
➝ lang="en">
<head>
<meta http-equiv="Content-Type"
➝ content="text/html;
➝ charset=utf-8"/>
<title>Greetings!</title>
</head>
<body>
<?php // Script 3.7 - hello.php
error_reporting (E_ALL | E_STRICT);
$name - $_GET['name'];
print "<p>Hello, <span
style=\font-weight:
bold;\">$name</span>!</p>";
?>
</body>
</html>
And this how it's look on web
http://santa-monica.comli.com/hello.html
http://santa-monica.comli.com/hello.php?name=Michael
change your php code to this -
<!DOCTYPE html PUBLIC "-//W3C//DTD
➝ XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/
➝ DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/
➝ 1999/xhtml" xml:lang="en"
➝ lang="en">
<head>
<meta http-equiv="Content-Type"
➝ content="text/html;
➝ charset=utf-8"/>
<title>Greetings!</title>
</head>
<body>
<?php // Script 3.7 - hello.php
error_reporting (E_ALL | E_STRICT);
$name = $_GET['name'];
print '<p>Hello, <span style="font-weight:bold;">'.$name.'</span>!</p>';
?>
</body>
</html>
your link to the php page is working fine, your problem is where u define the name variable, you have a typo, instead of $name = $_GET['name']; you put $name - $_GET['name'];, dont worry this happens to the best of us, fix that and it should run smoothly, btw if you are testing your php code on an online server dont, because it is slower than on your pc, unless you are contacting an api, it doesnt work unless its executing online
EDIT :
change your code to this :
<?php // Script 3.7 - hello.php
error_reporting (E_ALL | E_STRICT);
$name = $_GET['name'];
?>
<p>Hello, <span
style=\font-weight:
bold;\"><?php echo $name; ?></span>!</p>

Using PHP include to include a file with it's own included file

I am trying to load a projects.php file into a higher-level index.php file and want to maintain all the .js .css and any further nested (in .js files) .php files, that are declared in the projects.php file.
My index.php file goes like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>BLST</title>
</head>
<body>
<?php $projectsPage = "/tables/php/projects.php"?>
<li>Projects</li>
<?php if(is_null($_GET["page"])) {
$page = "";
}else{
$page = $_GET["page"];
}
include($page);
?>
</body>
</html>
My projects.php file is
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Projects</title>
<style type="text/css">
#import "css/test.css";
#import "http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.23/themes/smoothness/jquery-ui.css";
</style>
<script type="text/javascript" language="javascript" charset="utf-8" src="js/jquery.min.js"></script>
</head>
The issue is that none of the files in projects.php are found. This is because the browser is looking to my main directory now (where index.php is).
The test.css is in "tables/php/css/test.css" and what about the location of projects.php and index.php.
I think the answer to these will solve the problem.

jQuery Load Page Error

I'm trying to load a page when a div from my content is loaded , but isn't working. Can you help me and tell me where is my error or why isn't working ? Thanks !
Here's the code
index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="css/fonts.css" rel="stylesheet" type="text/css" />
</head>
<body>
<ul id="nav">
<li>index</li>
<li>contact</li>
</ul>
<div id="content"></div>
<script src="http://code.jquery.com/jquery-2.0.2.min.js" type="text/javascript"></script>
<script src="js/js.js" type="text/javascript"></script>
</body>
</html>
hello.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
And javascript
$(document).ready(function() {
$('#content').load('hello.php');
});
Use this in head section
<script src="http://code.jquery.com/jquery-2.0.2.min.js" type="text/javascript"></script>
<script src="js/js.js" type="text/javascript"></script>
Change your html like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="css/fonts.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-2.0.2.min.js" type="text/javascript"></script>
<script src="js/js.js" type="text/javascript"></script>
</head>
<body>
<ul id="nav">
<li>index</li>
<li>contact</li>
</ul>
<div id="content"></div>
</body>
</html>
And your Jquery like th is:
$("#content").load("/hello.php", function(response, status, xhr) {
if (status == "error") {
var msg = "Sorry but there was an error: ";
$("#error").html(msg + xhr.status + " " + xhr.statusText);
}
});
This should work, and if not it will let you know what happened.
You have to make sure this script tag
<script src="http://code.jquery.com/jquery-2.0.2.min.js" type="text/javascript"></script>
is executed before
$(document).ready(function() {
$('#content').load('hello.php');
});

doesnt display anything on the browser when using filename.php

it produces output when it is saved as filename.html
but when i try to change it to filename.php
then open the link in the brown using filename.php
it doesnt produce output anymore
NOTE: i removed some of the code too long
<?php
echo"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
print code requirement
function printpage()
{
window.print();
}
</script>
print code requirement
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>WildFlowers by FCT</title>
<link href='http://fonts.googleapis.com/css?family=Oswald:400,300' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Abel' rel='stylesheet' type='text/css'>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<style type="text/css">
#wrapper #header-wrapper #header h1 a strong {
font-family: Georgia, "Times New Roman", Times, serif;
size: '100';
font-size: 40px;
</body>
</html>
";
?>
You have to remove <?php and ?>. Between these two tags there must be php-code and no html.
Edit: Maybe no errors are reported, because your server is configured to suppress errors.
Put some space after the echo..And use single quote['] insted of double.And change all single quotes from your code to double quote.(")
eg: -
<?php echo '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body> Bla bla bla
</body>
</html>';
?>
The problem in your code is, you just started the codes with double quote.So the PHP server consider the next double quote is the closing of the echo statement.So there is nothing to print inside the first two double quote.But if you take the page source, you can see
<!DOCTYPE html PUBLIC
This is because you open PHP tag at the beginning of file:
<?php
Close it before your HTML markup:
<?php
// your php code
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
You can not have html in your php tags, if you want to use html you have to end the close your php first so something like this:
<?php
// php code here
?>
html code here
<?php
// php here
?>
If You need to write html inside php code use the echo statement.
ex:
<?php echo"
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head></head>
<body>
//your code here
</body>
</html>";
?>

</script> in PHP heredoc

Why I am not able to end a javascript inside a PHP heredoc?
The rest of the code below this line:
</script>
become not part of PHP's code. They become HTML code.
It is like the end script code ends the PHP block.
$headerContent = <<<HEAD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<title>$title</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2" />
<script>
</script> // Here is the problem
</head> // code here and below becomes not part of PHP.
<body>
.
.
.
HEAD;
Any tips for solving this problem?
Although I can't reproduce this with HEREDOC (it's possible that different versions of PHP behave differently in this respect), </script> is equivalent to ?> in PHP code, because it's a counterpart to <script language="php">. Example:
<script language="php"> $a = 1; </script>
Test: <?= $a ?>
So wherever you encounter problems with the ?> closing tag, you'll also encounter the same problems with the </script> closing tag. One option would be to store this in a variable and use it. Example:
<?php
$endScript = '</' . 'script>';
$headerContent = <<<HEAD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<title>$title</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2" />
<script>
$endScript
</head>
<body>
.
.
.
HEAD;

Categories