<?php
 
$xmlurl = simplexml_load_file('http://parancebinde.com/xml/resstoktek.xml');
 
$list = $xmlurl->urunler;
 
for ($i = 0; $i < count($list); $i++) {
 
/*
 
echo '<b>Ürün İd :</b> ' . $list[$i]->attributes()->productid . '<br>';
 
echo 'Stok Kodu : ' . $list[$i]->productsku . '<br><br>';
 
*/
 
 
 
//XMLwriter to write XML from scratch - Yeni XML oluştur.
$xml = new XMLWriter();
$xml->openMemory();
$xml->startElement("Urunler");
$xml->startElement("urun");  //Urun Başlanğıç
$xml->writeElement("urunid" . $list[$i]->attributes()->urunid );
$xml->writeElement("gtin" . $list[$i]->attributes()->gtin );
$xml->writeElement("urunadi" . $list[$i]->attributes()->urunadi );
$xml->writeElement("marka" . $list[$i]->attributes()->marka );
$xml->writeElement("kategori" . $list[$i]->attributes()->kategori );
$xml->writeElement("detay" . $list[$i]->attributes()->detay );
$xml->writeElement("fiyat" . $list[$i]->attributes()->fiyat );
$xml->writeElement("para_birimi" . $list[$i]->attributes()->para_birimi );
$xml->writeElement("kdv" . $list[$i]->attributes()->kdv );
$xml->writeElement("stok" . $list[$i]->attributes()->stok );

//Ürün Resimler tek tek bölünecek
$xml->writeElement("IMG1", $list[$i]->attributes()->IMG1 );
$xml->writeElement("IMG2", $list[$i]->attributes()->IMG2 );
$xml->writeElement("IMG3", $list[$i]->attributes()->IMG3 );
$xml->writeElement("IMG4", $list[$i]->attributes()->IMG4 );
$xml->writeElement("IMG5", $list[$i]->attributes()->IMG5 );
$xml->writeElement("IMG6", $list[$i]->attributes()->IMG6 );
$xml->writeElement("IMG7", $list[$i]->attributes()->IMG7 );
$xml->writeElement("IMG8", $list[$i]->attributes()->IMG8 );
$xml->endElement();  //Urun Bitiş
$xml->endElement();



file_put_contents('datasolar.xml', $xml->outputMemory());

}



?>
alanları cektım baska bır xml olusturdum ama degerlerı cekemedım.... ve bırde resımlerı nasıl bu sekılde tek tek bolebılırım acaba