Getting error in php Help Needed !!!

Discussion in 'PHP' started by ozone1, Jan 24, 2008.

  1. #1
    Hi i used the code below to download youtube videos from my site and it was working 100%
    <?php
    
    if (isset($_GET{'url'})){
    	$url=$_GET{'url'};
    	$url=trim($url);
    
    	if (strstr($_GET['url'],"youtube.com")){
    		$data = @file_get_contents($_GET['url']);
    		@preg_match('#/watch_fullscreen\?video_id=([a-z0-9-_]+)&l=([0-9]+)&t=([a-z0-9-_]+)#i', $data, $matches);
    		if (ereg($matches[1], $_GET['url'])) {
    			Header("Location: http://www.youtube.com/get_video?video_id=$matches[1]&l=$matches[2]&t=$matches[3]");
    		} 
    	}
    ?>
    Code (markup):


    but 2day im getting an error

    Warning: ereg() [function.ereg]: REG_EMPTY in /home/sitename/public_html/getvid.php on line 10
    Code (markup):
    can any1 help me how to fix it.

    i could download any youtube video before just by putting
    http://mysite.com/getvideo.php?url=http://youtube.com/watch?v=CoiFGva_JoY
    Code (markup):
    now its not working someone help me please
     
    ozone1, Jan 24, 2008 IP
  2. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #2
    @preg_match('#/watch_fullscreen\?video_id=([a-z0-9-_]+)&l=([0-9]+)&t=([a-z0-9-_]+)#i', $data, $matches);
    PHP:
    Chances are YouTube have changed they way they output videos, so that line doesn't exist anymore. Just go to YouTube and see how it outputs it's video_id and other required parameters, and change your source accordingly.

    Jay
     
    jayshah, Jan 24, 2008 IP