troubleshooting Question

need help solving preg_match() error

Avatar of befidled
befidled asked on
PHP
2 Comments1 Solution670 ViewsLast Modified:
I've got the following method which should be grabbing a youTube video to display on my site but I'm getting a preg_match error. Any idea what might cause this error?
<?php
function youtube($keyword) {
	$url = "http://www.youtube.com/rss/tag/dui.rss";
	$youtube = fopen($url, "r");
	if (preg_match('/<enclosure url=\"(.*)swf/s', $youtube, $y)) {
		$youtube = $y[1];
		$youtube = substr($y[1], 0, 36);
		$video = '';
		$video .= "\n".'<object type="application/x-shockwave-flash" style="width:400px; height:325px;" data="'.$youtube.'">';
    	$video .= "\n".'<param name="movie" value="'.$youtube.'" />';
    	$video .= "\n".'</object>';
    	$video .= "\n";
    	print $video;
    	
	}
}
?>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros