public function isValid() 
    {
      $headers = get_headers($this->url);
      $header = $headers[0]; // the result code
      $type = $headers[sizeof($headers) - 1]; // content type
      $m = array();

      if (preg_match("/\d{3}/", $header, $m)) {

        if (substr($m[0], 0, 1) == "2")
          return true;
      }

      return false;
    }
public function isValid() 
    {
      $headers = get_headers($this->url);
      $header = $headers[0]; // the result code
      $type = $headers[sizeof($headers) - 1]; // content type
      $m = array();

      if (preg_match("/\d{3}/", $header, $m)) {

        if (substr($m[0], 0, 1) == "2")
          return true;
      }

      return false;
    }
public function isValid ( ) { $ headers = get_headers ( $ this -> url ) ; $ header = $ headers [ 0 ] ; // the result code $ type = $ headers [ sizeof ( $ headers ) - 1 ] ; // content type $ m = array ( ) ; if ( preg_match ( "/\d{3}/" , $ header , $ m ) ) { if ( substr ( $ m [ 0 ] , 0 , 1 ) == "2" ) return true ; } return false ; }
this is for times we need
to check if a media file is
an actual media file

Note: this does not download
the file only checks if the
return code is valid
this is for times we need to check if a media file is an actual media file