无法下载 SWF 图像或使用 PHP 进行预览

Cant download a SWF image or preview it using PHP

Hi Stack溢出社区,

我一直在尝试从外部服务器下载 swf 图像,您可以通过简单的 url.

访问它

遗憾的是,下载的 SWF 不会显示在浏览器中,所以我认为它是一个损坏的文件。此外,我无法通过 PHP.

预览 SWF 文件

我知道我可以嵌入 SWF,但我有点需要它的屏幕截图或下载版本。

我测试过的用于将 SWF 下载到我的服务器的代码:

function save_swf(){
    $swf_file = file_get_contents('http://assets.zwinky.com/assets3/avatar/avatar10.8.swf?u=' . $this->username);
    file_put_contents(strtolower($this->award . '_' . $this->username . '.swf'), $this->swf);
}

我用来检查图像是否可以被预览的代码 PHP:

<?php
        $data = @file_get_contents('http://assets.zwinky.com/assets3/avatar/avatar10.swf?u=dane');
        header("content-type: application/x-shockwave-flash");
        header("Content-Disposition: inline;" echo $data);
        header("accept-ranges: bytes", true);
        header("connection: keep-alive", true);
        echo $data;
    ?>

有谁知道为什么它不起作用?

Basis SWF 我正在尝试从以下位置获取文件:http://assets.zwinky.com/assets3/avatar/avatar10.8.swf?u=dane

如果您将数据写入服务器本地的文件,则应执行以下操作:

// Write swf file locally using file_put_contents();
$fileName = ""; // The filepath where you've written it to

header("Content-Type: application/x-shockwave-flash",true);    
header("Content-Length: {strlen($fileName)}",true);    
header("Accept-Ranges: bytes",true);    
header("Connection: keep-alive",true);   
header("Content-Disposition: inline; filename=$fileName");  

readfile($fileName);

如果您需要任何其他帮助,请告诉我。