PHP code example of smsc / smsc-api-php

1. Go to this page and download the library: Download smsc/smsc-api-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

smsc / smsc-api-php example snippets


try {
	$smsc = new Smsc($your_user, $your_apikey);

	// Estado del servicio
	echo 'El estado del servicio es '.($smsc->getEstado()?'OK':'CAIDO').'. ';

	// Saldo
	echo 'Quedan: '.$smsc->getSaldo().' sms. ';
	
	// Enviar SMS
	$smsc->addNumero(2627, 000000);
	$smsc->setMensaje('Hola Mundo!');
	if ($smsc->enviar())
		echo 'Mensaje enviado.';
} catch (Exception $e) {
	echo 'Error '.$e->getCode().': '.$e->getMessage();
}
bash
composer