Add config options to manage SMS Gateway timeout
This commit is contained in:
parent
94f4e383f0
commit
49daa279e4
3 changed files with 13 additions and 2 deletions
|
@ -14,6 +14,8 @@ $debug=False;
|
||||||
// SMS Gateway
|
// SMS Gateway
|
||||||
$smsgw_url="http://192.168.8.28:8080";
|
$smsgw_url="http://192.168.8.28:8080";
|
||||||
$smsgw_ssl_verify=true;
|
$smsgw_ssl_verify=true;
|
||||||
|
$smsgw_ws_connect_timeout=5;
|
||||||
|
$smsgw_ws_timeout=5;
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,6 @@ require_once('logging.php');
|
||||||
require_once('functions.php');
|
require_once('functions.php');
|
||||||
|
|
||||||
require_once('sms_gw_api.php');
|
require_once('sms_gw_api.php');
|
||||||
$smsgw = new sms_gw_api($smsgw_url, $smsgw_ssl_verify);
|
$smsgw = new sms_gw_api($smsgw_url, $smsgw_ssl_verify, $smsgw_ws_connect_timeout, $smsgw_ws_timeout);
|
||||||
|
|
||||||
require('db.php');
|
require('db.php');
|
||||||
|
|
|
@ -6,9 +6,14 @@ Class sms_gw_api {
|
||||||
private $ws_url = null;
|
private $ws_url = null;
|
||||||
private $ws_ssl_verify = true;
|
private $ws_ssl_verify = true;
|
||||||
|
|
||||||
function sms_gw_api($ws_url, $ws_ssl_verify=true){
|
private $ws_connect_timeout = 5;
|
||||||
|
private $ws_timeout = 10;
|
||||||
|
|
||||||
|
function sms_gw_api($ws_url, $ws_ssl_verify = true, $ws_connect_timeout = 5, $ws_timeout = 10){
|
||||||
$this -> ws_url = $ws_url;
|
$this -> ws_url = $ws_url;
|
||||||
$this -> ws_ssl_verify = $ws_ssl_verify;
|
$this -> ws_ssl_verify = $ws_ssl_verify;
|
||||||
|
$this -> ws_connect_timeout = $ws_connect_timeout;
|
||||||
|
$this -> ws_timeout = $ws_timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -45,6 +50,10 @@ Class sms_gw_api {
|
||||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
|
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set timeouts
|
||||||
|
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $this -> ws_connect_timeout);
|
||||||
|
curl_setopt($curl, CURLOPT_TIMEOUT, $this -> ws_timeout);
|
||||||
|
|
||||||
$complete_url=$this -> ws_url.'/'.$url;
|
$complete_url=$this -> ws_url.'/'.$url;
|
||||||
curl_setopt($curl, CURLOPT_URL, $complete_url);
|
curl_setopt($curl, CURLOPT_URL, $complete_url);
|
||||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
|
Loading…
Reference in a new issue