set cron with parameter that run after specific time and than delete that cron job once execution complete using php
<p>I am working on twilio api. In which I want to execute a file which says your calling subscription have last 2 min remaining during conference call. </p>

<p>So for that I have remaining time of user lets say 210 seconds. and I have to pass ConferenceSid of current conference call into cron file a parameter. </p>

<p>This file will execute only after specific time after(ex. after 88 sec) of conference call start. So i have to set cron that run after 88 sec of conference call start and delete that dynamically created job once execution completed.</p>

<p>For cron job set I am using following crontab class. And here is my code which I am trying.</p>

<pre><code>$path = dirname(__FILE__);
$cron = $path . "/test.php ConferenceSid=".$_REQUEST['ConferenceSid'];
Crontab::addJob('*/1 * * * * php '.$cron);
Crontab::removeJob('*/1 * * * * php '.$cron);
</code></pre>

<p>I don't know how to pass parameter so file execute after 88 seconds.</p>

<p>Here is my Crontab class Which is found from another stack overflow answer. </p>

<pre><code>class Crontab {

    static private function stringToArray($jobs = '') {
        $array = explode("\r\n", trim($jobs)); // trim() gets rid of the last \r\n
        foreach ($array as $key =&gt; $item) {
            if ($item == '') {
                unset($array[$key]);
            }
        }
        return $array;
    }

    static private function arrayToString($jobs = array()) {
        $string = implode("\r\n", $jobs);
        return $string;
    }

    static public function getJobs() {
        $output = shell_exec('crontab -l');
        return self::stringToArray($output);
    }

    static public function saveJobs($jobs = array()) {
        $output = shell_exec('echo "' . self::arrayToString($jobs) . '" | crontab -');
        return $output;
    }

    static public function doesJobExist($job = '') {
        $jobs = self::getJobs();
        if (in_array($job, $jobs)) {
            return true;
        } else {
            return false;
        }
    }

    static public function addJob($job = '') {
        if (self::doesJobExist($job)) {
            return false;
        } else {
            $jobs = self::getJobs();
            $jobs[] = $job;
            return self::saveJobs($jobs);
        }
    }

    static public function removeJob($job = '') {
        if (self::doesJobExist($job)) {
            $jobs = self::getJobs();
            unset($jobs[array_search($job, $jobs)]);
            return self::saveJobs($jobs);
        } else {
            return false;
        }
     }
}
</code></pre>