note 114704 added to function.parse-url
| From: | ivijan dot stefan at gmail dot com | Date: | Wed, 26 Mar 2014 16:49:59 +0000 |
| Subject: | note 114704 added to function.parse-url | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199047@lists.php.net to get a copy of this message | ||
Here's a good way to using parse_url () gets the youtube link.
This function I used in many works:
<?php
function youtube($url, $width=560, $height=315, $fullscreen=true)
{
parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars );
$youtube= '<iframe allowtransparency="true" scrolling="no"
width="'.$width.'" height="'.$height.'"
src="//www.youtube.com/embed/'.$my_array_of_vars['v'].'"
frameborder="0"'.($fullscreen?'
allowfullscreen':NULL).'></iframe>';
return $youtube;
}
// show youtube on my page
$url='http://www.youtube.com/watch?v=yvTd6XxgCBE';
youtube($url, 560, 315, true);
?>
parse_url () allocates a unique youtube code and put into iframe link and displayed on your page.
The size of the videos choose yourself.
Enjoy.
----
Server IP: 192.41.45.150
Probable Submitter: 95.85.188.25
----
Manual Page -- http://php.net/manual/en/function.parse-url.php
Edit -- https://master.php.net/note/edit/114704
Del: integrated -- https://master.php.net/note/delete/114704/integrated
Del: useless -- https://master.php.net/note/delete/114704/useless
Del: bad code -- https://master.php.net/note/delete/114704/bad+code
Del: spam -- https://master.php.net/note/delete/114704/spam
Del: non-english -- https://master.php.net/note/delete/114704/non-english
Del: in docs -- https://master.php.net/note/delete/114704/in+docs
Del: other reasons-- https://master.php.net/note/delete/114704
Reject -- https://master.php.net/note/reject/114704
Search -- https://master.php.net/manage/user-notes.php