I have while loop and which is has 20 iterations. In one iteration it make of 500 products in XML format. It works fine when the products are 200, but if I decrease the products then it need to 50 iterations, which gives time exceed error.
I don't know how to balance this. If I fix one error of time exceed then the above titled error occurs but I fix this then time exceed error.
I am passing my products XML to Volusion API.
My Code is following.
<?php
// Developed BY Doulat Khan Technology Architects Islamabad.
$conn= mysql_connect('localhost, 'username', 'password');
if (!$conn) {
die('Could not connect: ' . mysql_error());
}
ini_set('max_execution_time', 300); //300 seconds = 5 minutes
$query = "SELECT * FROM `Vol_import_count` WHERE `imp_id` = '1'";
mysql_select_db('mydb');
$retval = mysql_query($query);
//print_r($retval);
if(! $retval )
{
die('Could not enter data: ' . mysql_error());
}
while($row = mysql_fetch_assoc($retval))
{
$cur_itration = $row['cur_itration'];
$total_itration = $row['total_itration'];
$status = $row['status'];
$offSet = $row['offSet'];
}
$cur_itration = 1;
$offset = 0;
$malab_url ="https://online.malabs.com/mws/items/?limit=500&offset=$offset";
while($cur_itration <= $total_itration) {
$new_url = $malab_url."&offset=$offset";
$offset += 500;
$cur_itration++;
include 'malab2vol.php';
include 'importPro.php';
include 'assignCat.php';
}
?>