How to execute certain part of code (eg sftp download) in php in certain time interval? If time exceeds, exception is to be handled -
i want put time interval sftp connection in php. if time exceeds 60 seconds connect it, should disrupted , exception handled. don't know how it.
i tried do:
set_time_limit(60)
but, not work.
i want put time limit in function:
private function __connectsftp() { $this->sftp = new net_sftp($this->host, 22); if (!$this->sftp->login($this->user, $this->password)) { return $this->_requesterrormessage('could not connect server'); } else { return $this->__downloadfile(); } }
i tried do:
$totime = time()+60; while(time() != $totime){ //connection code }
but, sadly doesn't work @ all.
i grateful if suggest me can do.
Comments
Post a Comment