Hi all,
My first question here.
The question is similar to this one: http://stackoverflow.com/questions/712161/php-retrying-a-query-a-set-number-of-times-or-until-success
Try till success in OO way. Here example what i'm trying to do:
class Creatives {
public function run() {
$auth_token='mypassword';
$id=123123;
$this->retry_till_success ( $this->getCreatives, array($auth_token, $id) );
print $this->creatives;
}
public function getCreatives($auth_token, $id) {
$this->creatives = $this->campagin->get($auth_token, $id);
}
private function retry_till_success($method, $args) {
do {
$try_again = false;
try {
/* how to call the method with */
/* call user method with params pass */
/* do until success */
} catch (SoapFault $fault) {
if($fault->faultstring== 'couldnt connect to host')
$try_again=true;
}
} while ($try_again);
}
}
i read about call_user_func, but don't know if i could use it inside the class, I need to make 99.9% success rate in my calls, any suggestion to achieve this will be great. thank you.