sms send

Php code posted
created at 02 Apr 16:45, updated at 04 Apr 15:31

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
  protected function sms() {
    require_once dirname(__FILE__) . '/sms_functions.php';
    $shortCodes = array(
      '0'    => '90429',
      '0.5'  => '90432',
      '1'    => '90426',
      '1.5'  => '90427',
      '2'    => '90428',
      '3'    => '99170',
    );
    $price = $this->session['init_data']['price'];
    $country_id = $this->session['init_data']['country_id'];
    $operator_id = $this->session['init_data']['operator_id'];
    $message = $this->session['init_data']['smsText'];
    $url = getShortUrl($this->session['flow_data']['download_url']);
    if ($this->session['init_data']['lang_id'] == 84) {
      $message = iconv('UTF-8', 'UTF-16LE', $message);
      $url = iconv('UTF-8', 'UTF-16LE', $url);
    }
//    $message = mb_convert_encoding($message, 'HTML-ENTITIES', 'UTF-8');

    $smsSender = new Tool_Api_Sms($country_id, $shortCodes[strval($price)] ,$operator_id);
    $sms_options = array(
      'shortcode' => $shortCodes[strval($price)],
      'title'  => $shortCodes[strval($price)],
      'msisdn' => $this->session['uid'],
      'purchase' => $this->session['flow_data']['purchase_id'],
      'billtype' => 'MT',
      'message' => $message . ' ' . $url,
//      'short_url' => true,
      'iswappush' => false,
      'message_test' => $message_test,
      'encoding' => $encoding,
      'langague_id' => $this->session['init_data']['lang_id'],
    );
    if (isset($this->session['flow_data']['bogof']) && $this->session['flow_data']['bogof'] === true) {
      $sms_options['psms_handler'] = 'http://m.gameloft.com/orange_jo/bogof_addcredit/'.$this->session['flow_data']['purchase_id'].'/'.$this->session['uid'].'/';
    }
    $result = $smsSender->sendSMS($sms_options);
    if ($result['result'] > 0) {
      $this->session['flow_data']['sms_sent'] = true;
      $this->session['flow_data']['sms_id'] = abs($result['result']);
    } else {
      $this->session['flow_data']['sms_sent'] = false;
      $this->session['flow_data']['sms_error'] = abs($result['result']);
    }
    $this->updateSession();
    mail('alexander.rudenko@gameloft.com,elena.borovik@gameloft.com', 'Orange JO Billing session', print_r(array($this, $sms_options), true));
    return $this->session['flow_data']['sms_sent'];
  }
2.11 KB in 6 ms with coderay