Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Extendscript从web服务器获取xml内容以获得后续效果_Xml_Http_Adobe_Extendscript_After Effects - Fatal编程技术网

使用Extendscript从web服务器获取xml内容以获得后续效果

使用Extendscript从web服务器获取xml内容以获得后续效果,xml,http,adobe,extendscript,after-effects,Xml,Http,Adobe,Extendscript,After Effects,我正在尝试获取web服务器上托管的XML文件,以便在After Effects脚本中使用 有人能澄清为什么这种方法似乎不起作用吗 //var xml_path = "/c/test.xml"; var xml_path = "http://transfer.proshopeurope.com/TEMP/test.xml"; function getXML(){ var xml_file = new File(this.xml_path); if(xml_file.open("

我正在尝试获取web服务器上托管的XML文件,以便在After Effects脚本中使用

有人能澄清为什么这种方法似乎不起作用吗

//var xml_path = "/c/test.xml";
var xml_path = "http://transfer.proshopeurope.com/TEMP/test.xml";

function getXML(){
    var xml_file = new File(this.xml_path);

    if(xml_file.open("r")){
        var xml_string = xml_file.read();
        var xml = new XML(xml_string);
        xml_file.close();
        return xml;
    }else{
        return false;
    }
}
$.writeln(getXML());

顺便说一句,如果我使用顶部注释掉的本地路径,它可以正常工作。

您不能使用“新文件”作为url,您需要使用“套接字”:

reply = "";
conn = new Socket;

if (conn.open ("transfer.proshopeurope.com:80")) {
    // send a HTTP GET request
    conn.writeln("GET /TEMP/test.xml HTTP/1.0\r\nHost: transfer.proshopeurope.com\r\n");
    // and read the server's reply
    reply = conn.read(999999);
    conn.close();
}

这将把所有响应返回到“reply”中,然后您应该使用regex只获取xml。

您不一定需要使用套接字。主要原因是套接字不支持SSL。因此,如果通过SSL连接,ExtendScript套接字将失败

可以使用system.callSystem()进行shell调用。例如,看看我刚才问过的“编辑2”下的代码

要进行更深入的讨论,请查看我讨论的更多细节