我有一个wordpress网站,其中安装了一个名为“ WP All Import”的插件。
我从供应商的xml文件导入了我的产品,但问题是该插件不支持该结构。 我有2个不同的xml文件,每个文件中都有一个相同的字段。
我使用此php代码获取xml文件
<?php $url = "ftp://domain:pass@transfer.domain.com/myxml.xml";
header('Content-Type: text/plain');
header('Content-Disposition: attachment; filename="ftp-proxy-data.txt"');
header('Pragma: no-cache');
readfile($url);`
,然后在另一个php文件中
<?php $url = "ftp://domain:pass@transfer.domain.com/myxmlSECOND.xml";
header('Content-Type: text/plain');
header('Content-Disposition: attachment; filename="ftp-proxy-data.txt"');
header('Pragma: no-cache');
readfile($url);
问题是我从第一个文件中获得
<?xml version="1.0" encoding="UTF-8"?>
<PRODUCTINFORMATION>
<PRODUCTS>
<PRODUCT>
<PRODUCT_NUMBER>MO8930-03</PRODUCT_NUMBER>
<PRODUCT_BASE_NUMBER>MO8930</PRODUCT_BASE_NUMBER>
<PRODUCT_PRINT_ID>40006167</PRODUCT_PRINT_ID>
<PRODUCT_NAME>SQUARE</PRODUCT_NAME>
<LONG_DESCRIPTION>4 port USB hub in ABS.</LONG_DESCRIPTION>
<COLOR_CODE>03</COLOR_CODE>
<COLOR_DESCRIPTION>black</COLOR_DESCRIPTION>
</PRODUCT>
<PRODUCT>
<PRODUCT_NUMBER>MO8930-05</PRODUCT_NUMBER>
<PRODUCT_BASE_NUMBER>MO8930</PRODUCT_BASE_NUMBER>
<PRODUCT_PRINT_ID>40006167</PRODUCT_PRINT_ID>
<PRODUCT_NAME>SQUARE</PRODUCT_NAME>
<LONG_DESCRIPTION>4 port USB hub in ABS.</LONG_DESCRIPTION>
<COLOR_CODE>05</COLOR_CODE>
<COLOR_DESCRIPTION>red</COLOR_DESCRIPTION>
</PRODUCT>
</PRODUCTS>
</PRODUCTINFORMATION>
从第二个文件中我得到
<?xml version="1.0" encoding="UTF-8"?>
<PRINTINGINFORMATION>
<PRODUCTS>
<PRODUCT>
<PRODUCT_BASE_NUMBER>MO8930</PRODUCT_BASE_NUMBER>
<PRODUCT_PRINT_ID>40006167</PRODUCT_PRINT_ID>
<PRINTING_POSITIONS>
<PRINTING_POSITION>
<ID>TOP</ID>
<PRINTING_SIZE_UNIT>mm</PRINTING_SIZE_UNIT>
<MAX_PRINT_SIZE_HEIGHT>20</MAX_PRINT_SIZE_HEIGHT>
<MAX_PRINT_SIZE_WIDTH>40</MAX_PRINT_SIZE_WIDTH>
<PRINTING_TECHNIQUE>
<ID>DL</ID>
<MAX_COLORS>8</MAX_COLORS>
</PRINTING_TECHNIQUE>
<PRINTING_TECHNIQUE>
<ID>P2</ID>
<MAX_COLORS>4</MAX_COLORS>
</PRINTING_TECHNIQUE>
</PRINTING_POSITION>
<PRINTING_POSITION>
<ID>TOP PD</ID>
<PRINTING_SIZE_UNIT>mm</PRINTING_SIZE_UNIT>
<MAX_PRINT_SIZE_HEIGHT>29</MAX_PRINT_SIZE_HEIGHT>
<MAX_PRINT_SIZE_WIDTH>50</MAX_PRINT_SIZE_WIDTH>
<PRINTING_TECHNIQUE>
<ID>PD1</ID>
<MAX_COLORS>8</MAX_COLORS>
</PRINTING_TECHNIQUE>
</PRINTING_POSITION>
</PRINTING_POSITIONS>
</PRODUCT>
</PRODUCTS>
</PRINTINGINFORMATION>
我实际上想从中得到什么
<?xml version="1.0" encoding="UTF-8"?>
<PRODUCTINFORMATION>
<PRODUCTS>
<PRODUCT>
<PRODUCT_NUMBER>MO8930-03</PRODUCT_NUMBER>
<PRODUCT_BASE_NUMBER>MO8930</PRODUCT_BASE_NUMBER>
<PRODUCT_PRINT_ID>40006167</PRODUCT_PRINT_ID>
<PRODUCT_NAME>SQUARE</PRODUCT_NAME>
<LONG_DESCRIPTION>4 port USB hub in ABS.</LONG_DESCRIPTION>
<COLOR_CODE>03</COLOR_CODE>
<COLOR_DESCRIPTION>black</COLOR_DESCRIPTION>
<PRINTING_POSITIONS>
<PRINTING_POSITION>
<ID>TOP</ID>
<PRINTING_SIZE_UNIT>mm</PRINTING_SIZE_UNIT>
<MAX_PRINT_SIZE_HEIGHT>20</MAX_PRINT_SIZE_HEIGHT>
<MAX_PRINT_SIZE_WIDTH>40</MAX_PRINT_SIZE_WIDTH>
<PRINTING_TECHNIQUE>
<ID>DL</ID>
<MAX_COLORS>8</MAX_COLORS>
</PRINTING_TECHNIQUE>
<PRINTING_TECHNIQUE>
<ID>P2</ID>
<MAX_COLORS>4</MAX_COLORS>
</PRINTING_TECHNIQUE>
</PRINTING_POSITION>
<PRINTING_POSITION>
<ID>TOP PD</ID>
<PRINTING_SIZE_UNIT>mm</PRINTING_SIZE_UNIT>
<MAX_PRINT_SIZE_HEIGHT>29</MAX_PRINT_SIZE_HEIGHT>
<MAX_PRINT_SIZE_WIDTH>50</MAX_PRINT_SIZE_WIDTH>
<PRINTING_TECHNIQUE>
<ID>PD1</ID>
<MAX_COLORS>8</MAX_COLORS>
</PRINTING_TECHNIQUE>
</PRINTING_POSITION>
</PRINTING_POSITIONS>
</PRODUCT>
<PRODUCT>
<PRODUCT_NUMBER>MO8930-05</PRODUCT_NUMBER>
<PRODUCT_BASE_NUMBER>MO8930</PRODUCT_BASE_NUMBER>
<PRODUCT_PRINT_ID>40006167</PRODUCT_PRINT_ID>
<PRODUCT_NAME>SQUARE</PRODUCT_NAME>
<LONG_DESCRIPTION>4 port USB hub in ABS.</LONG_DESCRIPTION>
<COLOR_CODE>05</COLOR_CODE>
<COLOR_DESCRIPTION>red</COLOR_DESCRIPTION>
<PRINTING_POSITIONS>
<PRINTING_POSITION>
<ID>TOP</ID>
<PRINTING_SIZE_UNIT>mm</PRINTING_SIZE_UNIT>
<MAX_PRINT_SIZE_HEIGHT>20</MAX_PRINT_SIZE_HEIGHT>
<MAX_PRINT_SIZE_WIDTH>40</MAX_PRINT_SIZE_WIDTH>
<PRINTING_TECHNIQUE>
<ID>DL</ID>
<MAX_COLORS>8</MAX_COLORS>
</PRINTING_TECHNIQUE>
<PRINTING_TECHNIQUE>
<ID>P2</ID>
<MAX_COLORS>4</MAX_COLORS>
</PRINTING_TECHNIQUE>
</PRINTING_POSITION>
<PRINTING_POSITION>
<ID>TOP PD</ID>
<PRINTING_SIZE_UNIT>mm</PRINTING_SIZE_UNIT>
<MAX_PRINT_SIZE_HEIGHT>29</MAX_PRINT_SIZE_HEIGHT>
<MAX_PRINT_SIZE_WIDTH>50</MAX_PRINT_SIZE_WIDTH>
<PRINTING_TECHNIQUE>
<ID>PD1</ID>
<MAX_COLORS>8</MAX_COLORS>
</PRINTING_TECHNIQUE>
</PRINTING_POSITION>
</PRINTING_POSITIONS>
</PRODUCT>
</PRODUCTS>
</PRODUCTINFORMATION>
有没有办法让我每次调用这2个php文件时得到此结果?
谢谢。