summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md23
1 files changed, 11 insertions, 12 deletions
diff --git a/README.md b/README.md
index cb4c0fb..0b6da9d 100644
--- a/README.md
+++ b/README.md
@@ -17,13 +17,12 @@ To send a SMS you can do:
``` php
<?php
-$GLOBALS['SMPP_ROOT'] = dirname(__FILE__); // assumes this file is in the root
-require_once $GLOBALS['SMPP_ROOT'].'/protocol/smppclient.class.php';
-require_once $GLOBALS['SMPP_ROOT'].'/protocol/gsmencoder.class.php';
-require_once $GLOBALS['SMPP_ROOT'].'/transport/tsocket.class.php';
+require_once 'smppclient.class.php';
+require_once 'gsmencoder.class.php';
+require_once 'sockettransport.class.php';
// Construct transport and client
-$transport = new TSocket('your.smsc.com',2775);
+$transport = new SocketTransport(array('smpp.provider.com'),3600);
$transport->setRecvTimeout(10000);
$smpp = new SmppClient($transport);
@@ -37,11 +36,12 @@ $smpp->bindTransmitter("USERNAME","PASSWORD");
// Optional connection specific overrides
//SmppClient::$sms_null_terminate_octetstrings = false;
//SmppClient::$sms_use_msg_payload_for_csms = true;
+//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(GsmEncoder::utf8_to_gsm0338('SMPP Tést'),SMPP::TON_ALPHANUMERIC);
+$from = new SmppAddress(SMPP Test',SMPP::TON_ALPHANUMERIC);
$to = new SmppAddress(4512345678,SMPP::TON_INTERNATIONAL,SMPP::NPI_E164);
// Send
@@ -55,12 +55,11 @@ To receive a SMS (or delivery receipt):
``` php
<?php
-$GLOBALS['SMPP_ROOT'] = dirname(__FILE__); // assumes this file is in the root
-require_once $GLOBALS['SMPP_ROOT'].'/protocol/smppclient.class.php';
-require_once $GLOBALS['SMPP_ROOT'].'/transport/tsocket.class.php';
+require_once 'smppclient.class.php';
+require_once 'sockettransport.class.php';
// Construct transport and client
-$transport = new TSocket('your.smsc.com',2775);
+$transport = new SocketTransport(array('smpp.provider.com'),3600);
$transport->setRecvTimeout(60000); // for this example wait up to 60 seconds for data
$smpp = new SmppClient($transport);
@@ -85,9 +84,9 @@ Implementation notes
- You can't connect as a transceiver, otherwise supported by SMPP v.3.4
- The SUBMIT_MULTI operation of SMPP, which sends a SMS to a list of recipients, is not supported atm. You can easily add it though.
- - The thrift sockets will return false if the timeout is reached (after version 0.6.0).
+ - The sockets will return false if the timeout is reached on read() (but not readAll or write).
You can use this feature to implement an enquire_link policy. If you need to send enquire_link for every 30 seconds of inactivity,
- set a timeout of 30 seconds, and send the enquire_link command if readSMS() returns false.
+ set a timeout of 30 seconds, and send the enquire_link command after readSMS() returns false.
- The examples above assume that the SMSC default datacoding is [GSM 03.38](http://en.wikipedia.org/wiki/GSM_03.38).
- Remember to activate registered delivery if you want delivery receipts (set to SMPP::REG_DELIVERY_SMSC_BOTH / 0x01).
- Both the SmppClient and transport components support a debug callback, which defaults to error_log. Use this to redirect debug information. \ No newline at end of file