Skip to content

Instantly share code, notes, and snippets.

@Roemerb
Created May 30, 2016 13:36
Show Gist options
  • Save Roemerb/b0fd4f0fd9d1c79da2fe6feb6221c4ba to your computer and use it in GitHub Desktop.
Save Roemerb/b0fd4f0fd9d1c79da2fe6feb6221c4ba to your computer and use it in GitHub Desktop.
<?php
require_once 'smppclient.class.php';
require_once 'gsmencoder.class.php';
require_once 'sockettransport.class.php';
// Construct transport and client
$transport = new SocketTransport(array('smpp.provider.com'),2775);
$transport->setRecvTimeout(10000);
$smpp = new SmppClient($transport);
// Activate binary hex-output of server interaction
$smpp->debug = true;
$transport->debug = true;
// Open the connection
$transport->open();
$smpp->bindTransmitter("USERNAME","PASSWORD");
// Optional connection specific overrides
//SmppClient::$sms_null_terminate_octetstrings = false;
//SmppClient::$csms_method = SmppClient::CSMS_PAYLOAD;
//SmppClient::$sms_registered_delivery_flag = SMPP::REG_DELIVERY_SMSC_BOTH;
// Prepare message
$message = 'H€llo world';
$encodedMessage = GsmEncoder::utf8_to_gsm0338($message);
$from = new SmppAddress('SMPP Test',SMPP::TON_ALPHANUMERIC);
$to = new SmppAddress(4512345678,SMPP::TON_INTERNATIONAL,SMPP::NPI_E164);
// Send
$smpp->sendSMS($from,$to,$encodedMessage,$tags);
// Close connection
$smpp->close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment