doulue7522 2012-02-22 12:52
浏览 39
已采纳

如何从url知道flv大小的大小?

If I know flv video, for example:

www.domain.com/video.flv

I can't use "filesize" because it doesn't able to check size from external url, right?
So, how can I know his size?

  • 写回答

4条回答 默认 最新

  • duanquyong8164 2012-02-22 13:03
    关注

    You can use CURL to get the headers of a remote file, including the size of a file.

    $url = 'http://www.domain.com/video.flv';
    
    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_HEADER, true); 
    curl_setopt($ch, CURLOPT_NOBODY, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 
    curl_setopt($ch, CURLOPT_URL, $url); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); 
    $headers = curl_exec($ch);
    
    $size = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
    
    curl_close($ch); 
    

    Setting CURLOPT_NOBODY to true, makes CURL not download the body of a requested URL.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记