private function advanced($type, $data = null)
 {
     $mageSOAPAdvanced = new mageSOAPAdvanced();
     switch ($type) {
         case 'reindex':
             $mageSOAPAdvanced->reindexAll();
             echo "Reindex done\n";
             break;
         case 'images':
             return $mageSOAPAdvanced->getImageList();
             break;
         case 'cloaksimple':
             return $mageSOAPAdvanced->cloaksimpleproducts();
             break;
         case 'addcatnamestoproducts':
             return $mageSOAPAdvanced->addcatnamestoproducts();
             break;
         case 'firstaddcatnamestoproducts':
             return $mageSOAPAdvanced->initcatproducts();
             break;
         case 'orderstatusupdate':
             return $mageSOAPAdvanced->updateorderstatus($data);
             break;
         case 'createurlkeys':
             return $mageSOAPAdvanced->createurlkeys($data);
             break;
         case 'createurlrewrite':
             return $mageSOAPAdvanced->prepareurlrewrites($data);
             break;
         case 'addImages':
             if (isset($data)) {
                 return $mageSOAPAdvanced->assignImages($data);
             }
             break;
         case 'numbers':
             return $mageSOAPAdvanced->getNumberList();
             break;
         case 'urllist':
             return $mageSOAPAdvanced->getUrlList();
             break;
         case 'configprods':
             return $mageSOAPAdvanced->getConfigList();
             break;
         case 'simpleprods':
             return $mageSOAPAdvanced->getSimpleList();
             break;
         case 'showStock':
             return $mageSOAPAdvanced->showStock();
             break;
         case 'deletespecials':
             return $mageSOAPAdvanced->deletespecials();
             break;
         case 'setStock':
             if (isset($data)) {
                 return $mageSOAPAdvanced->setStock($data);
             }
             break;
         case 'geturlkeylist':
             return $mageSOAPAdvanced->geturlkeyjson($data['path']);
             break;
         case 'orderByOID':
             if (isset($data) && isset($data['increment_id'])) {
                 return $mageSOAPAdvanced->getOrderByOID($data['increment_id']);
             }
             break;
         case 'categories':
             if (isset($data)) {
                 return $mageSOAPAdvanced->updateCategories($data);
             }
             break;
         case 'linkProductsToCategories':
             if (isset($data)) {
                 return $mageSOAPAdvanced->linkProductsToCategories($data);
             }
             break;
         case 'linkCrossselling':
             if (isset($data)) {
                 return $mageSOAPAdvanced->linkCrossselling($data);
             }
             break;
         case 'cleanUpProductFamilies':
             if (isset($data)) {
                 return $mageSOAPAdvanced->cleanUpProductFamilies($data);
             }
             break;
         case 'disableConfigurableProductsWithNoEnabledChildren':
             return $mageSOAPAdvanced->disableConfigurableProductsWithNoEnabledChildren();
             break;
     }
 }
<?php

require __DIR__ . "/mageSOAPAdvanced.php";
$mage = new mageSOAPAdvanced();
$data = (include "/var/www/staging/current/server/mey/getCategoryAssignmentData.php");
$start = microtime(true);
$result = $mage->linkProductsToCategories($data);
echo "categories: ", count($result), "\n";
echo "duration: ", round(microtime(true) - $start, 2), " sec\n";