Function sendSmsToSmppVersion1

@author: 713uk13m <dev@nguyenanhung.com>
@time  : 11/22/18 15:49

@return $this
768811
public function sendSmsToSmppVersion1()
    {

        $this->logger->debug(__FUNCTION__, 'Input Data Send SMS to SMPP Version 1 => ' . json_encode($this->inputData));
        $phone_number = $this->inputData['phone_number'];
        $msg          = $this->inputData['msg'];
        $phone_number = $this->phoneNumber->vn_convert_phone_number($phone_number, 'new');
        $msg          = trim($msg);
        $url          = $this->wsConfig['url'];
        $method       = $this->wsConfig['method'];
        $params       = array(
            'username' => $this->wsConfig['username'],
            'password' => $this->wsConfig['password'],
            'to'       => $phone_number,
            'text'     => $msg
        );
        $this->logger->debug(__FUNCTION__, 'SendSms To SMPP Version 1');
        $this->logger->debug(__FUNCTION__, 'SendSms Method: ' . json_encode($method));
        $this->logger->debug(__FUNCTION__, 'MT Message Length: ' . $this->lengthMtMessage($msg));
        if (strtoupper($method) == 'GET') {
            $this->logger->debug(__FUNCTION__, 'SendSms Url: ' . json_encode($url . '?' . http_build_query($params)));
        } else {
            $this->logger->debug(__FUNCTION__, 'SendSms Url: ' . json_encode($url));
            $this->logger->debug(__FUNCTION__, 'SendSms Params: ' . json_encode($params));
        }
        $responseSms = $this->requests->sendRequest($url, $params, $method);
        $this->logger->debug(__FUNCTION__, 'SendSms Result: ' . json_encode($responseSms));
        if ($responseSms === NULL || empty($responseSms)) {
            $result = array(
                'code'          => self::API_ERROR_CODE,
                'description'   => 'Error',
                'data'          => array(
                    'msg'           => 'Không gửi được MT. Response từ API về không hợp lệ',
                    'requestResult' => $responseSms
                ),
                'request_data'  => array('url' => $url, 'params' => $params, 'method' => $method),
                'response_data' => $responseSms,
                'content_data'  => array(
                    'phone_number' => $params['to'],
                    'msg'          => $params['text'],
                    'mo'           => isset($this->inputData['mo']) ? $this->inputData['mo'] : NULL,
                    'note'         => isset($this->inputData['note']) ? $this->inputData['note'] : NULL,
                    'subCode'      => isset($this->inputData['subCode']) ? $this->inputData['subCode'] : NULL
                )
            );
        } else {
            if ($responseSms == self::SMPP_VER_1_SUCCESS) {
                $result = array(
                    'code'          => self::EXIT_SUCCESS,
                    'description'   => 'Success',
                    'data'          => array('requestResult' => $responseSms),
                    'request_data'  => array('url' => $url, 'params' => $params, 'method' => $method),
                    'response_data' => $responseSms,
                    'content_data'  => array(
                        'phone_number' => $params['to'],
                        'msg'          => $params['text'],
                        'mo'           => isset($this->inputData['mo']) ? $this->inputData['mo'] : NULL,
                        'note'         => isset($this->inputData['note']) ? $this->inputData['note'] : NULL,
                        'subCode'      => isset($this->inputData['subCode']) ? $this->inputData['subCode'] : NULL
                    )
                );
            } else {
                $result = array(
                    'code'          => self::EXIT_ERROR,
                    'description'   => 'Failed',
                    'data'          => array('requestResult' => $responseSms),
                    'request_data'  => array('url' => $url, 'params' => $params, 'method' => $method),
                    'response_data' => $responseSms,
                    'content_data'  => array(
                        'phone_number' => $params['to'],
                        'msg'          => $params['text'],
                        'mo'           => isset($this->inputData['mo']) ? $this->inputData['mo'] : NULL,
                        'note'         => isset($this->inputData['note']) ? $this->inputData['note'] : NULL,
                        'subCode'      => isset($this->inputData['subCode']) ? $this->inputData['subCode'] : NULL
                    )
                );
            }
        }
        if ($this->responseIsObject) {
            $result = Utils::arrayToObject($result);
        }
        $this->sendSmsResult = $result;
        $this->logger->info(__FUNCTION__, 'Send SMS Result: ' . json_encode($this->sendSmsResult));

        return $this;
    }
1289578
public function send()
    {

        if ($this->Logger->isEnabled()) {

            $this->Logger->debug($this->message->toString());

        }


        //Now check if Swift actually sends it
        if (!$this->testingOnly) {

            //Now check if Swift actually sends it
            $this->getMailer()->send($this->message);

        }
        return $this;

    }
559613
public function sendHeaders(): self
    {
        // headers have already been sent by the developer
        if (\headers_sent()) {
            return $this;
        }

        /* RFC2616 - 14.18 says all Responses need to have a Date */
        if (!$this->header->has('Date')) {
            $this->setDate(\DateTime::createFromFormat('U', (string) \time()));
        }

        // status
        \header('HTTP/' . $this->version . ' ' . $this->status . ' ' . $this->reason, true, $this->status);

        // headers
        $headers = $this->header->all();
        $this->cookie->inject($headers);

        foreach ($this->header->all() as $name => $values) {
            $first = true;
            foreach ($values as $value) {
                \header($name . ': ' . $value, $first, $this->status);
                $first = false;
            }
        }

        return $this;
    }
877996
public function Send () {
		if ($this->IsSent()) return;
		$httpVersion = $this->GetHttpVersion();
		$code = $this->GetCode();
		$status = $this->codeMessage !== NULL
			? ' '.$this->codeMessage
			: (isset(static::$codeMessages[$code]) 
				? ' '.static::$codeMessages[$code] 
				: '');
		if (!isset($this->headers['Content-Encoding'])) {
			if (!$this->encoding) $this->encoding = 'utf-8';
			$this->headers['Content-Encoding'] = $this->encoding;
		}
		$this->UpdateHeaders();
		header($httpVersion . ' ' . $code . $status);
		header('Host: ' . $this->request->GetHost());
		foreach ($this->headers as $name => $value) {
			if ($name == 'Content-Type') {
				$charsetMatched = FALSE;
				$charsetPos = strpos($value, 'charset');
				if ($charsetPos !== FALSE) {
					$equalPos = strpos($value, '=', $charsetPos);
					if ($equalPos !== FALSE) $charsetMatched = TRUE;
				}
				if (!$charsetMatched) $value .= ';charset=' . $this->encoding;
			}
			if (isset($this->disabledHeaders[$name])) {
				header_remove($name);
			} else {
				header($name . ": " . $value);
			}
		}
		foreach ($this->disabledHeaders as $name => $b)
			header_remove($name);
		$this->addTimeAndMemoryHeader();
		echo $this->body;
		if (ob_get_level()) echo ob_get_clean();
		flush();
		$this->sent = TRUE;
	}
1332740
public function send($to)
    {
        $this->checkParams();
        $params = [
            'account' => Config::get('APIID'),
            'mobile' => strval($to),
            'content' => $this->params['content'],
            'time' => time(),
            'stime' => isset($this->params['stime'] )? $this->params['stime'] : time(),
            'format' => self::ENDPOINT_FORMAT
        ];
        $params['password'] = $this->generateSign($params);
        return $this->post(self::ENDPOINT_URL, $params);
    }
1061528
public function sendHeaders()
     {
         if (! headers_sent()) {
             $response = $this->getResponse();
             foreach ($response->getHeaders() as $name => $value) {
                 header($name.': '.$value, false);
             }
             header('HTTP/1.1'.' '.$response->getStatusCode().' '.$response->getStatusMessage());
         }

         return $this;
     }
662510
public function send()
    {
        $provider = $this->getProvider();
        if (!$provider) {
            throw new \RuntimeException('未设置短信供应商');
        }

        $provider->send($this);

        return $this;
    }
684759
private function backupCurrentVersion()
    {
        $this->fs->copy($this->currentInstallerFile, $this->currentInstallerBackupFile, true);
        $this->restorePreviousInstaller = true;

        return $this;
    }
1305794
public function getServerVersion()
    {
        if (!$this->serverVersion) {
            $this->method = 'getServerVersion';
            $this->sendRequest();
            $this->method = null;
        }

        return $this->serverVersion;
    }
446195
public function setHTTPVersion($version = self::HTTP_1)
	{
		if ($version == self::HTTP_0 || $version == self::HTTP_1) {
			$this->httpVersion = $version;
		} else {
			throw new RuntimeException('Invalid HTTP version setted.');
		}
		
		return $this;
	}
314632
public function sendHeaders()
    {
        foreach ($this->getHeaders() as $name => $values) {
            foreach ($values as $value) {
                header(sprintf('%s: %s', $name, $value), false);
            }
        }

        return $this;
    }
629245
public function version()
    {
        /**
         * version\r\n
         */

        // Build packet to send ...
        $data = self::COMMAND_VERSION . self::COMMAND_TERMINATOR;

        return $this->send(self::COMMAND_VERSION, $data);
    }
28583
public function Send()
	{
		$tscall = array("TriggeredSendDefinition" => $this->props , "Subscribers" => $this->subscribers);
		$response = new ET_Post($this->authStub, "TriggeredSend", $tscall);
		return $response;
	}
273477
public function sendHeaders()
	{
		if (!$this->checkHeadersSent())
		{
			foreach ($this->response->headers as $header)
			{
				if ('status' == strtolower($header['name']))
				{
					// 'status' headers indicate an HTTP status, and need to be handled slightly differently
					$this->header(ucfirst(strtolower($header['name'])) . ': ' . $header['value'], null, (int) $header['value']);
				}
				else
				{
					$this->header($header['name'] . ': ' . $header['value']);
				}
			}
		}

		return $this;
	}
91022
public function sendHeaders()
	{
		// Early return if headers already have been send
		if (headers_sent()) {
			return $this;
		}

		foreach ($this->headers as $key => $value) {
			header(
				sprintf('%s: %s', $key, is_array($value) ? implode('; ', $value) : $value),
				true,
				$this->statusCode
			);
		}

		header(sprintf('%s %s %s',
			self::$protocolVersionMap[$this->protocolVersion],
			$this->statusCode,
			self::$statusCodeMap[$this->statusCode]
		));

		return $this;
	}
88083
def SendVersion(self):
        """"""
        m = Message("version", VersionPayload(settings.NODE_PORT, self.remote_nodeid, settings.VERSION_NAME))
        self.SendSerializedMessage(m)
643259
public function setVersion($version)
    {
        if ($version != '1.1' && $version != '1.0') {
            throw new InvalidArgumentException('Not valid or not supported HTTP version: ' . $version);
        }

        $this->_version = $version;
        return $this;
    }