I’m dealing with this for the first time so I’m not sure how to implement it. So I receive data via XML feed from URL and my code right now looks like this:
$products_url = ‘here comes URL to XML’;
$products = DcXmlToArray($products_url);
if(isset($products[‘product’]) && !empty($products[‘product’])) {
foreach($products[‘product’] as $key => $product) {
$img_url = 'another URL for images...';
$images = DcXmlToArray($img_url);
foreach($images['image'] as $image) {
//doing some work in here
}
}
function DcXmlToArray looks like this:
function DcXmlToArray($url) {
$xml = simplexml_load_file($url, ‘SimpleXMLElement’,LIBXML_NOCDATA);
$json = json_encode($xml);
$arr = json_decode($json,true);
return $arr;
}
And it all works very slowly (especially because of this URL with images) and I contacted support and there they told me to try multithreadingand they gave me this LINK
But I’m not sure how to implement this into my code. Thanks.