do { $responder = $soapresponsearray; $responder[] = $beginner; $responder[] = $beginner + $steps; $responder = json_encode($responder, true); $imageHandlerResponse = doCurlCall("https://s01.shop.fortuneglobe.com/mey/alvine/gfx/item/onlinestore/imageHandler.php?c", $responder); //print_r($imageHandlerResponse); $tmpimagehandlerresponse = json_decode($imageHandlerResponse, true); if (is_array($tmpimagehandlerresponse)) { $imagefinalresponse = array_merge($imagefinalresponse, $tmpimagehandlerresponse); } $counter -= $steps; $beginner += $steps; } while ($counter > 0); $soapCallString = '{"data": {"action" : "advanced", "type" : "simpleprods"}}'; $soapResponseRewrite = doCurlCall($SOAPPath, $soapCallString); // Create Final Entrys for SOAPAdvanced $ResponseStringImages = json_encode($imagefinalresponse, true); //Create Files file_put_contents($filepathImages, $ResponseStringImages); file_put_contents($filepathRewrites, $soapResponseRewrite); echo "true"; function doCurlCall($url, $dataString) { $curlHandler = curl_init(); $curlOptions = array(CURLOPT_URL => $url, CURLOPT_HTTPHEADER => array('Content-Type: application/json', 'Content-Length: ' . strlen($dataString)), CURLOPT_POSTFIELDS => $dataString, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_FRESH_CONNECT => true, CURLOPT_FORBID_REUSE => true); curl_setopt_array($curlHandler, $curlOptions); $callResponse = curl_exec($curlHandler); curl_close($curlHandler); return $callResponse; }
<?php $ch = curl_init(); $soapStockCallString = '{"data": {"action" : "advanced", "type" : "showStock"}}'; $stockData = doCurlCall("http://*****:*****@www.mey.com/service/index.php", $soapStockCallString); $data = []; $soapCallString = '{"data": {"action" : "advanced", "type" : "setStock", "data": ' . $data . '}}'; $soapResponse = doCurlCall("http://*****:*****@www.mey.com/service/index.php", $soapCallString); var_dump($soapResponse); function doCurlCall($url, $dataString) { $curlHandler = curl_init(); $curlOptions = array(CURLOPT_URL => $url, CURLOPT_HTTPHEADER => array('Content-Type: application/json', 'Content-Length: ' . strlen($dataString)), CURLOPT_POSTFIELDS => $dataString, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_FRESH_CONNECT => true, CURLOPT_FORBID_REUSE => true); curl_setopt_array($curlHandler, $curlOptions); $callResponse = curl_exec($curlHandler); curl_close($curlHandler); return $callResponse; }
$imagefinalresponse = array(); $beginner = 0; //Begin of GetImage $steps = 1000; //Steps for Loop $soapresponsearray = json_decode($soapResponse, true); $counter = sizeof($soapresponsearray); // Max Size of Loops //$counter = 1000; do { $responder = $soapresponsearray; $responder[] = $beginner; $responder[] = $beginner + $steps; $responder = json_encode($responder, true); /* FIRSTLOAD EXCEPTION BEGIN */ $imageHandlerResponse = doCurlCall("http://www.mey.com/alvine/gfx/item/onlinestore/imageHandler.php?c", $responder); /* FIRSTLOAD EXCEPTION END */ /* Comment after Firstload Begin */ /* $imageHandlerResponse = doCurlCall("http://mey.labs.idnt.net/media/import/tmp/imageHandler.php?c", $responder); /* Comment after Firstload End */ //print_r($imageHandlerResponse); $tmpimagehandlerresponse = json_decode($imageHandlerResponse, true); if (is_array($tmpimagehandlerresponse)) { $imagefinalresponse = array_merge($imagefinalresponse, $tmpimagehandlerresponse); } $counter -= $steps; $beginner += $steps; } while ($counter > 0);
ini_set("default_socket_timeout", 0); ini_set("max_execution_time", 0); $time_start = microtime(true); /* Test to Update an URL Key */ /* BEGIN */ /* $productids = array(298722); $soapCallString = '{"data": {"action" : "advanced", "type" : "createurlkeys", "data": ' . json_encode($productids) . '}}'; $soapResponse = doCurlCall("http://*****:*****@localhost/MeyTest/service/index.php",$soapCallString ); /* END */ /* Test to Update an URL Key */ /* Test to Create an URL Rewrite */ /* BEGIN */ $productids = array(10530); $soapCallString = '{"data": {"action" : "advanced", "type" : "createurlrewrite", "data": ' . json_encode($productids) . '}}'; $soapResponse = doCurlCall("http://*****:*****@127.0.0.1:8080/ultimo/service/index.php", $soapCallString); /* END */ /* Test to Create a URL Rewrite */ print_r($soapResponse); $time_end = microtime(true); $time = $time_end - $time_start; echo "Das Bilden der notwendigen URL Keys brauchte {$time} Sekunden\n"; function doCurlCall($url, $dataString) { $curlHandler = curl_init(); $curlOptions = array(CURLOPT_URL => $url, CURLOPT_HTTPHEADER => array('Content-Type: application/json', 'Content-Length: ' . strlen($dataString)), CURLOPT_POSTFIELDS => $dataString, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_FRESH_CONNECT => true, CURLOPT_FORBID_REUSE => true); curl_setopt_array($curlHandler, $curlOptions); $callResponse = curl_exec($curlHandler); curl_close($curlHandler); return $callResponse; }
die("Fertig"); } $workdata = json_encode($runqueue, true); // Step 2 Work with Data switch ($mode) { case 'image': $ImportDataString = '{"data": {"action" : "advanced", "type" : "addImages", "data": ' . $workdata . '}}'; $AdvancedResponse = doCurlCall($SOAPPath, $ImportDataString); break; case 'url-key': $ImportDataString = '{"data": {"action" : "advanced", "type" : "createurlkeys", "data": ' . $workdata . '}}'; $AdvancedResponse = doCurlCall($SOAPPath, $ImportDataString); break; case 'url-rewrite': $ImportDataString = '{"data": {"action" : "advanced", "type" : "createurlrewrite", "data": ' . $workdata . '}}'; $AdvancedResponse = doCurlCall($SOAPPath, $ImportDataString); break; default: die("Keine Vorgehensweise gefunden!"); break; } // Sandbox //print_r($AdvancedResponse); //die(); file_put_contents($filepath, json_encode($checkupdates, true)); //print_r($AdvancedResponse); $time_end = microtime(true); $time = $time_end - $time_start; echo "Das Verarbeiten des Skriptes brauchte {$time} Sekunden und es sind noch " . sizeof($checkupdates) . " Einträge unbearbeitet.\n"; if (sizeof($runqueue) > 0) { ?>
$runqueue = array_slice($checkupdates, 0, $steps); for ($i = 0; $i < $steps; $i++) { if (sizeof($checkupdates) > 0) { unset($checkupdates[key($checkupdates)]); } else { break; } } } if (sizeof($runqueue) <= 0) { die("Fertig"); } $workdata = json_encode($runqueue, true); // Step 2 Work with Data $ImportDataString = '{"data": {"action" : "advanced", "type" : "createurlrewrite", "data": ' . $workdata . '}}'; if (doCurlCall($SOAPPath, $ImportDataString)) { file_put_contents($filepathRewrites, json_encode($checkupdates, true)); } if (sizeof($runqueue) > 0) { echo "false"; } else { echo "true"; } function doCurlCall($url, $dataString) { $curlHandler = curl_init(); $curlOptions = array(CURLOPT_URL => $url, CURLOPT_HTTPHEADER => array('Content-Type: application/json', 'Content-Length: ' . strlen($dataString)), CURLOPT_POSTFIELDS => $dataString, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_FRESH_CONNECT => true, CURLOPT_FORBID_REUSE => true); curl_setopt_array($curlHandler, $curlOptions); $callResponse = curl_exec($curlHandler); $httpStatusCode = curl_getinfo($curlHandler, CURLINFO_HTTP_CODE); curl_close($curlHandler);