检索远程文件的完整详细信息而不下载它

发布于 2024-12-16 15:09:55 字数 170 浏览 6 评论 0原文

我怎样才能提取元数据/METAINFO/描述远程文件的所有内容而不先下载它地方?

你有一些 PHP 代码片段吗? 在 cURL 中怎么样? 或任何语言?

谢谢

How could I extract the METADATA / METAINFO / everything that would describe the REMOTE FILE without downloading it in the first place?

do you have some snippets in PHP?
how about in cURL?
or any language?

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

神魇的王 2024-12-23 15:09:55

如果不下载整个文件,您就无法从文件中获取所有元数据,因为在捕获元数据块之前您无法知道需要文件的多少部分,某些文件格式将元数据存储在文件的末尾文件(意味着您无论如何都需要整个文件),某些文件根本没有嵌入任何元数据,等等。

如果您执行 HEAD 请求,您通常能够以服务器返回的内容类型和内容长度标头的形式获取相关文件的一些基本元数据,但这是通常仅限于 MIME 类型和文件大小(如果您正在处理为文件提供服务的脚本,并且该脚本没有设置必要的标头,您甚至可能无法得到它)。

You can't get all the metadata from a file without downloading the entire file, as you have no way of knowing how much of the file you need before you've captured its metadata block, some file formats store metadata at the end of the file (meaning you'll need the entire file anyway), some files don't have any metadata embedded in them at all, and so on.

If you do a HEAD request, you will usually be able to get some basic metadata on the file in question in the form of the content-type and content-length headers returned by the server, but this is typically limited to the MIME type and the file size (and if you're dealing with a script that serves the file and that script doesn't set the necessary headers, you might not even get that).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文