to send SMS Reports from Piwik.

About ASPSMS.com: '; } public function getCredentialFields() { return array( array( 'type' => 'text', 'name' => 'username', 'title' => 'MobileMessaging_UserKey' ), array( 'type' => 'text', 'name' => 'password', 'title' => 'General_Password' ), ); } public function verifyCredential($credentials) { $this->getCreditLeft($credentials); return true; } public function sendSMS($credentials, $smsText, $phoneNumber, $from) { $from = substr($from, 0, self::MAXIMUM_FROM_LENGTH); $smsText = self::truncate($smsText, self::MAXIMUM_CONCATENATED_SMS); $additionalParameters = array( 'Recipients' => array($phoneNumber), 'MessageText' => $smsText, 'Originator' => $from, 'AffiliateID' => '227830', ); $this->issueApiCall( $credentials, self::SEND_SMS_RESOURCE, $additionalParameters ); } private function issueApiCall($credentials, $resource, $additionalParameters = array()) { $accountParameters = array( 'UserName' => $credentials['username'], 'Password' => $credentials['password'], ); $parameters = array_merge($accountParameters, $additionalParameters); $url = self::BASE_API_URL . $resource; $timeout = self::SOCKET_TIMEOUT; try { $result = Http::sendHttpRequestBy( Http::getTransportMethod(), $url, $timeout, $userAgent = null, $destinationPath = null, $file = null, $followDepth = 0, $acceptLanguage = false, $acceptInvalidSslCertificate = true, $byteRange = false, $getExtendedInfo = false, $httpMethod = 'POST', $httpUserName = null, $httpPassword = null, $requestBody = json_encode($parameters) ); } catch (Exception $e) { throw new APIException($e->getMessage()); } $result = @json_decode($result, true); if (!$result || $result['StatusCode'] != 1) { throw new APIException( 'ASPSMS API returned the following error message : ' . $result['StatusInfo'] ); } return $result; } public function getCreditLeft($credentials) { $credits = $this->issueApiCall( $credentials, self::CHECK_CREDIT_RESOURCE ); return Piwik::translate('MobileMessaging_Available_Credits', array($credits['Credits'])); } }