I have created php script which gets data and writes it to XML file. the task is executed by using for loop in php. for today execution it will run from 1 to 10. but when I will execute the script again I want it to continue from 11 to 20 in for loop. but as I have written for 1 to 10 in php file it will execute every time same. These values fetch the proper value from the server is their any way to update for value every time script execute. Sample Code:
for ($i=1; $i<2; $i++)
{
//$url = $link3;
$url = $link1 . $i . $link2;
// Set the url
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
$file=curl_exec($ch);
$fileName = "data.xml";
if ( file_exists($fileName)) {
$xml = simplexml_load_file($fileName);
}
else {
$xml= new SimpleXMLElement('<results />');
}
$array = json_decode ($file, true);
// Remove _class element
foreach ( $array['results'] as $key=>$result ) {
unset($array['results'][$key]['_class']);
}
arrayToXml($array['results'], $xml);
$xml->asXML($fileName);
}
Based on the Value of i API URL is decided and I also refer page from API I can fetch max 10 page at a time. So i have to execute this script after few days .
for ($i=$start; $i < $start + 10; $i++) {actions}?$startreference is lost.