Tuesday, 3 February 2015

How to download and extract zip files from url located in an xml field into one directory on web server



I have 100+ of these XML files and they don't have the images to where I can automate it. I need to be able to download "partImage" from each listing (which downloads as a .zip) extract it into a common directory, (in the process removing the zip folder as there is no rhyme or reason to the name of it) so that I can import it into our product catalog by image name which corresponds to the part number. I have seen many examples to do part of this, but not fully automate which is necessary. Thanks!



<part>
<partNumber>37040152</partNumber>
<punctuatedPartNumber>3704-0152</punctuatedPartNumber>
<partStatusDescr>Standard</partStatusDescr>
<partDescr>CLEANER WASH DEGREASE GL</partDescr>
<uom>EA</uom>
<brandName>1.7</brandName>
<supplierNumber>CS-1G</supplierNumber>
<baseDealerPrice>****.****</baseDealerPrice>
<yourDealerPrice>****.****</yourDealerPrice>
<retailPrice>****.****</retailPrice>
<originalRetailPrice>****.****</originalRetailPrice>
<partImage>http://ift.tt/1KpWraT;
<productId>222779</productId>
<productName>FORMULA-1 WASH DEGREASER CONCENTRATE</productName>
<productImage>http://ift.tt/1AqDjcx;
<bullet1>Cuts through the toughest grime and dirt</bullet1>
<bullet2>Leaves the bike clean and like new</bullet2>
<bullet3>16 fl. oz. bottles, 12 per case; gallon jugs, 4 per case; sold each</bullet3>
</part>

No comments:

Post a Comment