I read many useful answers here and the most of them helped me to create script for importing data from XML file. Problem is that this time i have additional part with images url's witch also needs to be updated into MySQL.
For now, i update MySQL with data from XML, after that use other script to download needed images. After website with XML feed changed they structure, i have problem to figure out how to update images url in array into MySQL row so i can download images after that.
Even i choose to download images without updating into MySQL, i also can't download them.
This is XML structure
<ArrayOfUnitDTO xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<UnitDTO>
<Category>Category name</Category>
<code>863</code>
<Status>Blocked</Status>
<RefNo>12345</RefNo>
<Images>
<Image>
<Title>Community</Title>
<ImageURL>http://imageaddress.com/images/watermark.aspx?imageurl=/uf/1015/GroupUpdate/unit/350/350_Image.jpg&width=640&group=1015&module=1&watermarktype=default&position=Center</ImageURL>
</Image>
<Image>
<Title>Local Area Image</Title>
<ImageURL>http://imageaddress.com/images/watermark.aspx?imageurl=/uf/1015/GroupUpdate/unit/631/631_Image.jpg&width=640&group=1015&module=1&watermarktype=default&position=Center</ImageURL>
</Image>
</Images>
</UnitDTO>
</ArrayOfUnitDTO>
I am i am using this
foreach ($listings ->UnitDTO as $listingInfo) //loop read xml
{
$RefNo = $listingInfo->RefNo;
$Category = $listingInfo->Category;
$code = $listingInfo->code;
$Status = $listingInfo->Status;
mysqli_query($link,"REPLACE INTO UnitDTO (`RefNo`, `Category`, `code`, `Status`) VALUES ('$RefNo', '$Category', '$code', '$Status',)") or die(mysqli_error($link));
}
No metter what i tried, i can't import images url into imageurl MySQL row in array.