Overview

Namespaces

  • SMSApi
    • Api
      • Action
        • Mms
        • Phonebook
        • Sender
        • Sms
        • User
        • Vms
      • Response
    • Exception
    • Proxy
      • Http

Classes

  • SMSApi\Proxy\Http\AbstractHttp
  • SMSApi\Proxy\Http\Curl
  • SMSApi\Proxy\Http\Native
  • Overview
  • Namespace
  • Class
  1: <?php
  2: 
  3: namespace SMSApi\Api\Action\Mms;
  4: 
  5: use SMSApi\Api\Action\AbstractAction;
  6: use SMSApi\Api\Response\StatusResponse;
  7: use SMSApi\Proxy\Uri;
  8: 
  9: /**
 10:  * Class Send
 11:  * @package SMSApi\Api\Action\Mms
 12:  *
 13:  * @method StatusResponse execute()
 14:  */
 15: class Send extends AbstractAction
 16: {
 17:     /**
 18:      * @param $data
 19:      * @return StatusResponse
 20:      */
 21:     protected function response($data)
 22:     {
 23:         return new StatusResponse($data);
 24:     }
 25: 
 26:     /**
 27:      * @return Uri
 28:      * @throws \SMSApi\Exception\ActionException
 29:      */
 30:     public function uri() {
 31: 
 32:         $query = "";
 33: 
 34:         $query .= $this->paramsLoginToQuery();
 35: 
 36:         $query .= $this->paramsBasicToQuery();
 37: 
 38:         $query .= $this->paramsOther();
 39: 
 40:         return new Uri( $this->proxy->getProtocol(), $this->proxy->getHost(), $this->proxy->getPort(), "/api/mms.do", $query );
 41:     }
 42: 
 43:     /**
 44:      * Set mobile phone number of the recipients.
 45:      *
 46:      * @param $to array|string phone number
 47:      * @return $this
 48:      */
 49:     public function setTo( $to ) {
 50: 
 51:         if ( !is_array( $to ) ) {
 52:             $to = array( $to );
 53:         }
 54: 
 55:         $this->to->exchangeArray( $to );
 56:         return $this;
 57:     }
 58: 
 59:     /**
 60:      * Set name of the group from the phone book to which message should be sent.
 61:      *
 62:      * @param string $group group name
 63:      * @return $this
 64:      */
 65:     public function setGroup( $group ) {
 66:         $this->group = $group;
 67:         return $this;
 68:     }
 69: 
 70:     /**
 71:      * Set scheduled date sending message.
 72:      *
 73:      * Setting a past date will result in sending message instantly.
 74:      *
 75:      * @param $date
 76:      * @return $this
 77:      */
 78:     public function setDateSent( $date ) {
 79:         $this->date = $date;
 80:         return $this;
 81:     }
 82: 
 83:     /**
 84:      * Set optional custom value sent with SMS and sent back in CALLBACK.
 85:      *
 86:      * @param string|array $idx
 87:      * @return $this
 88:      */
 89:     public function setIDx( $idx ) {
 90:         if ( !is_array( $idx ) ) {
 91:             $idx = array( $idx );
 92:         }
 93: 
 94:         $this->idx->exchangeArray( $idx );
 95:         return $this;
 96:     }
 97: 
 98:     /**
 99:      * Set checking idx is unique.
100:      *
101:      * Prevents from sending more than one message with the same idx.
102:      * When this parameter is set and message with the same idx was
103:      * already sent error 53 is returned.
104:      *
105:      * @param bool $check
106:      * @return $this
107:      */
108:     public function setCheckIDx( $check ) {
109:         if ( $check == true ) {
110:             $this->params[ "check_idx" ] = "1";
111:         } else if ( $check == false ) {
112:             $this->params[ "check_idx" ] = "0";
113:         }
114: 
115:         return $this;
116:     }
117: 
118: 
119:     /**
120:      * Set affiliate code.
121:      *
122:      * @param string $partner affiliate code
123:      * @return $this
124:      */
125:     public function setPartner( $partner ) {
126:         $this->params[ "partner_id" ] = $partner;
127:         return $this;
128:     }
129: 
130:     /**
131:      * Set message subject.
132:      *
133:      * @param string $subject subject of message
134:      * @return $this
135:      */
136:     public function setSubject( $subject ) {
137:         $this->params[ "subject" ] = $subject;
138:         return $this;
139:     }
140: 
141:     /**
142:      * Set MMS smill.
143:      *
144:      * @param string $smil xml smill
145:      * @return $this
146:      */
147:     public function setSmil( $smil ) {
148:         $this->params[ "smil" ] = urlencode($smil);
149:         return $this;
150:     }
151: 
152: }
SMSAPI Api Client API documentation generated by ApiGen