How to get the html code (embed) from url on youtube, metacafe, dailymotion etc.?

AndyPSV
AndyPSV used Ask the Experts™
on
i.e topic
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Could you please explain a bit more what you are looking for? i.e. what do you start with, and what you are trying to get.

Author

Commented:
I provide the URL: http://www.youtube.com/watch?v=FmSeK_xz7RY&feature=fvhl
and get this:
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/FmSeK_xz7RY&hl=en&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/FmSeK_xz7RY&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>

Open in new window

Commented:
Ok, try something like this (adapt for the other sites)
<?php
 
$url = 'http://www.youtube.com/watch?v=FmSeK_xz7RY&feature=fvhl';
 
$info = parse_url($url);
 
$params = array();
parse_str($info['query'], $params);
 
echo '<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/'.$params['v'].'&hl=en&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'.$params['v'].'&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>';
 
?>

Open in new window

Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
how about the daily motion, metacafe etc?

Commented:
The same can be done with the metacafe.com and dialymotion.com as jausions says, how url pattern they use this is the important part.

Author

Commented:
thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial