Skip to content

kaloryfer/smsapi-php-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMSAPI PHP Client

Klient PHP pozwalający na wysyłanie wiadomości SMS, MMS, VMS oraz zarządzanie kontem w serwisie SMSAPI.pl

<?php

use SMSApi\Client;
use SMSApi\Api\SmsFactory;
use SMSApi\Exception\SmsapiException;

require_once 'vendor/autoload.php';

$client = new Client('login');
$client->setPasswordHash(md5('super tajne haslo'));

$smsapi = new SmsFactory;
$smsapi->setClient($client);

try {
	$actionSend = $smsapi->actionSend();

	$actionSend->setTo('600xxxxxx');
	$actionSend->setText('Hello World!!');
	$actionSend->setSender('Info'); //Pole nadawcy, lub typ wiadomości: 'ECO', '2Way'

	$response = $actionSend->execute();

	foreach ($response->getList() as $status) {
		echo $status->getNumber() . ' ' . $status->getPoints() . ' ' . $status->getStatus();
	}
} catch (SmsapiException $exception) {
	echo 'ERROR: ' . $exception->getMessage();
}

Przykład zmiany adresu serwera na zapasowy:

<?php

use SMSApi\Client;
use SMSApi\Api\SmsFactory;
use SMSApi\Proxy\Http\Native;

require_once 'vendor/autoload.php';

$client = new Client('login');
$client->setPasswordHash(md5('haslo'));

$proxy = new Native('https://api2.smsapi.pl'); // zapasowy serwer

$smsapi = new SmsFactory($proxy);
$smsapi->setClient($client);

$actionSend = $smsapi->actionSend();

$actionSend->setTo('600xxxxxx');
$actionSend->setText('Hello World!!');
$actionSend->setSender('Info');

foreach ($actionSend->execute()->getList() as $status) {
    echo $status->getNumber() . ' ' . $status->getPoints() . ' ' . $status->getStatus();
}

Dokumentacja API biblioteki.

Sprawdź na przykładach, w jaki sposób można korzystać z biblioteki (examples).

Wymagania

  • PHP >= 5.3
  • allow_url_fopen lub rozszerzenie curl

Instalacja

W swoim projekcie dodaj do composer.json pakiet :

{
    "require": {
        "smsapi/php-client": "1.4.*"
    }
}

Licencja

Apache 2.0 License

About

Klient napisany w języku PHP, pozwalający na wysyłanie wiadomości SMS, MMS, VMS oraz zarządzanie kontem w serwisie SMSAPI.pl

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%