Skip to content

Commit

Permalink
Improvement of Alternate Gateway TMobileCZ
Browse files Browse the repository at this point in the history
  • Loading branch information
jbubik committed Jun 5, 2014
1 parent ea70be7 commit 0bbff24
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions application/models/gateway/tmobilecz_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0bbff24

Please sign in to comment.