code: protected function checkUrlExistsAndSize($fileUri, array $mediaFileInfo)
      {
          $mediaFileInfo['url'] = $fileUri;
          //File is a URL. Create a curl connection but DON'T download the body content
          //because we want to see if file is too big.
          $curl = curl_init();
          curl_setopt($curl, CURLOPT_URL, "$fileUri");
          curl_setopt($curl, CURLOPT_USERAGENT,
              "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11");
          curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($curl, CURLOPT_HEADER, false);
          curl_setopt($curl, CURLOPT_NOBODY, true);
  
          if (curl_exec($curl) === false) {
              return false;
          }
  
          //While we're here, get mime type and filesize and extension
          $info                           = curl_getinfo($curl);
          $mediaFileInfo['filesize']      = $info['download_content_length'];
          $mediaFileInfo['filemimetype']  = $info['content_type'];
          $mediaFileInfo['fileextension'] = pathinfo(parse_url($mediaFileInfo['url'], PHP_URL_PATH), PATHINFO_EXTENSION);
          curl_close($curl);
  
          return $mediaFileInfo;
      }
docs: Check that the URL given actually exists and is resolvable and that
  the file located there is within size limits.
  
  What are the size limits? I dunno!
  
  @param string $fileUri
  @param array  $mediaFileInfo
  @return bool|array