diff options
-rw-r--r-- | README.md | 40 |
1 files changed, 37 insertions, 3 deletions
@@ -5,7 +5,9 @@ This is a simplified SMPP client lib for sending or receiving smses through [SMP In addition to the client, this lib also contains an encoder for converting UTF-8 text to the GSM 03.38 encoding, and a socket wrapper. The socket wrapper provides connection pool, IPv6 and timeout monitoring features on top of PHP's socket extension. -This lib has changed significantly from it's first release, which required namespaces and included some worker components. You'll find that release at https://github.com/onlinecity/php-smpp/tree/1.0.1-namespaced. +This lib has changed significantly from it's first release, which required namespaces and included some worker components. You'll find that release at [1.0.1-namespaced](https://github.com/onlinecity/php-smpp/tree/1.0.1-namespaced.) + +This lib requires the [sockets](http://www.php.net/manual/en/book.sockets.php) PHP-extension, and is not supported on Windows. A [windows-compatible](https://github.com/onlinecity/php-smpp/tree/windows-compatible) version is also available. Basic usage example @@ -20,12 +22,13 @@ require_once 'gsmencoder.class.php'; require_once 'sockettransport.class.php'; // Construct transport and client -$transport = new SocketTransport(array('smpp.provider.com'),3600); +$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(); @@ -63,6 +66,7 @@ $smpp = new SmppClient($transport); // Activate binary hex-output of server interaction $smpp->debug = true; +$transport->debug = true; // Open the connection $transport->open(); @@ -100,4 +104,34 @@ Implementation notes 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 + - Both the SmppClient and transport components support a debug callback, which defaults to [error_log](http://www.php.net/manual/en/function.error-log.php) . Use this to redirect debug information. + +F.A.Q. +----- + +**Is this lib compatible with PHP 5.2.x ?** +It's tested on PHP 5.3, but is known to work with 5.2 as well. + +**Can it run on windows?** +It requires the sockets extension, which is available on windows, but is incomplete. Use the [windows-compatible](https://github.com/onlinecity/php-smpp/tree/windows-compatible) version instead, which uses fsockopen and stream functions. + +**Why am I not seeing any debug output?** +Remember to implement a debug callback for SocketTransport and SmppClient to use. Otherwise they default to [error_log](http://www.php.net/manual/en/function.error-log.php) which may or may not print to screen. + +**Why do I get 'res_nsend() failed' or 'Could not connect to any of the specified hosts' errors?** +Your provider's DNS server probably has an issue with IPv6 addresses (AAAA records). Try to set ```SocketTransport::$forceIpv4=true;```. You can also try specifying an IP-address (or a list of IPs) instead. Setting ```SocketTransport:$defaultDebug=true;``` before constructing the transport is also useful in resolving connection issues. + +**I tried forcing IPv4 and/or specifying an IP-address, but I'm still getting 'Could not connect to any of the specified hosts'?** +It would be a firewall issue that's preventing your connection, or something else entirely. Make sure debug output is enabled and displayed. If you see something like 'Socket connect to 1.2.3.4:2775 failed; Operation timed out' this means a connection could not be etablished. If this isn't a firewall issue, you might try increasing the connect timeout. The sendTimeout also specifies the connect timeout, call ```$transport->setSendTimeout(10000);``` to set a 10-second timeout. + +**Why do I get 'Failed to read reply to command: 0x4', 'Message Length is invalid' or 'Error in optional part' errors?** +Most likely your SMPP provider doesn't support NULL-terminating the message field. The specs aren't clear on this issue, so there is a toggle. Set ```SmppClient::$sms_null_terminate_octetstrings = false;``` and try again. + +**What does 'Bind Failed' mean?** +It typically means your SMPP provider rejected your login credentials, ie. your username or password. + +**Can I test the client library without a SMPP server?** +Many service providers can give you a demo account, but you can also use the [logica opensmpp simulator](http://opensmpp.logica.com/CommonPart/Introduction/Introduction.htm#simulator) (java) or [smsforum client test tool](http://www.smsforum.net/sctt_v1.0.Linux.tar.gz) (linux binary). In addition to a number of real-life SMPP servers this library is tested against these simulators. + +**I have an issue that not mentioned here, what do I do?** +Please obtain full debug information, and open an issue here on github. Make sure not to include the Send PDU hex-codes of the BindTransmitter call, since it will contain your username and password. Other hex-output is fine, and greatly appeciated. Any PHP Warnings or Notices could also be important. Please include information about what SMPP server you are connecting to, and any specifics.
\ No newline at end of file |