Мой первый вопрос здесь.
Вопрос похож на этот: PHP: повторная попытка запроса установленное число раз или до успеха
Попробуй до успеха в ОО пути.
Вот пример того, что я пытаюсь сделать:
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);
}
}
Я читал о call_user_func, но не знаю, смогу ли я использовать его внутри класса,
Мне нужно добиться успеха на 99,9% в моих звонках, любое предложение для достижения этого будет отличным.
спасибо.