How can i identify video urls whether live or not?

Discussion in 'PHP' started by HussainMHB, May 3, 2013.

  1. #1
    As a php programmer, how can i find exactly this are all active and those are all inactive urls.
    For example if we've 50 urls, we got to find it in php code.
    First we run and it results urls active and inactive respectively.
     
    HussainMHB, May 3, 2013 IP
  2. Hamidsam

    Hamidsam Greenhorn

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    23
    #2
    <?php
     
    $video_url = 'http://domain/path/to/video';
    $error_message = '404'; // or "Page not found", depends on your service
     
    $video_existance = TRUE;
     
    if ($data = file_get_contents($video_url))
    {
        if (strpos($data, $error_message))
            $video_existance = FALSE;
    }
    else
        $video_existance = FALSE;
     
    var_dump($video_existance);
    PHP:
     
    Hamidsam, May 5, 2013 IP