From 0bbff24e7bfb1ac9898c1f32bd905871aee0a712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bub=C3=ADk?= Date: Thu, 5 Jun 2014 23:32:33 +0200 Subject: [PATCH] Improvement of Alternate Gateway TMobileCZ --- application/models/gateway/tmobilecz_model.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/application/models/gateway/tmobilecz_model.php b/application/models/gateway/tmobilecz_model.php index 7054cd165..fb2b174ca 100644 --- a/application/models/gateway/tmobilecz_model.php +++ b/application/models/gateway/tmobilecz_model.php @@ -124,12 +124,14 @@ function sendTMobileCZ($uid, $pwd, $phone, $msg, $isFlash=false, $dRpt=false, $h $cookies=$cache_path."cookie_".__CLASS__."_".$uid; if (! is_really_writable($cache_path)) return "Cookie file $cookies not writable"; + if ((($cookiemt=filemtime($cookies))!==false)&&((time()-$cookiemt)>300)) //cookies older than 5mins + unlink($cookies); curl_setopt($curl, CURLOPT_COOKIEFILE, $cookies); curl_setopt($curl, CURLOPT_COOKIEJAR, $cookies); curl_setopt($curl, CURLOPT_URL, "https://sms.t-mobile.cz/closed.jsp"); curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0"); - curl_setopt($curl, CURLOPT_REFERER, "https://sms.t-mobile.cz/"); - log_message('debug',"TMCZ> getting first page..."); + curl_setopt($curl, CURLOPT_REFERER, ""); + log_message('debug',"TMCZ> getting first page..."); $text = curl_exec($curl); // Check if any error occured @@ -146,7 +148,7 @@ function sendTMobileCZ($uid, $pwd, $phone, $msg, $isFlash=false, $dRpt=false, $h "nextURL=checkStatus.jsp&errURL=clickError.jsp&". "username=".urlencode($uid)."&remember=1&". "password=".urlencode($pwd)."&submit=Přihlásit"); - log_message('debug',"TMCZ> logging in..."); + log_message('debug',"TMCZ> logging in..."); $text = curl_exec($curl); // Check if any error occured @@ -177,6 +179,7 @@ function sendTMobileCZ($uid, $pwd, $phone, $msg, $isFlash=false, $dRpt=false, $h ($dRpt?"confirmation=1&":""). //confirm SMS delivery ($hist?"history=on&":""). //save in provider's history "email=".urlencode($emlCopy)); //provider will send a copy to e-mail + log_message('debug',"TMCZ> sending SMS..."); $text = curl_exec($curl); // Check if any error occured