// Construct transport and client
$transport = new SocketTransport(array('my IP'),3700);
$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","pass");
// Prepare message
$message = 'this is a test';
$encodedMessage = GsmEncoder::utf8_to_gsm0338($message);
$from = new SmppAddress(source,SMPP::TON_ALPHANUMERIC);
$to = new SmppAddress(dest,SMPP::TON_INTERNATIONAL,SMPP::NPI_E164);
// Send
$smpp->sendSMS($from,$to,$message,$tags);
// Close connection
$smpp->close();
?>
I have trying to connect the SMSC via SMPP3.4. Im having the smpp account with real ip/username/password. smpp account tested and working fine.
[root@linux]# php untitled.php
Connecting to ip:3700...
Connected to ip:3700!
Binding transmitter...
Send PDU : 44 bytes
xxxxxxxx
command_id : 0x2
sequence number : 1
Read PDU : 27 bytes
xxxx
command id : 0x80000002
command status : 0x0 No Error
sequence number : 1
Binding status : 0
Send PDU : 70 bytes
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
command_id : 0x4
sequence number : 2
Read PDU : 16 bytes
xxxxxxxxxxxxxxxxxxxxxxxxx
command id : 0x80000004
command status : 0x1 Message Length is invalid
sequence number : 2
Fatal error: Uncaught exception 'SmppException' with message 'Message Length is invalid' in /usr/local/apache/htdocs/replaceme/http/devK/linux/smppclient.class.php:621
Stack trace:
1 /usr/local/apache/htdocs/replaceme/http/devK/linux/smppclient.class.php(339): SmppClient->submit_sm(Object(SmppAddress), Object(SmppAddress), 'this is a test', NULL, 0)
2 /usr/local/apache/htdocs/replaceme/http/devK/linux/untitled.php(31): SmppClient->sendSMS(Object(SmppAddress), Object(SmppAddress), 'this is a test', NULL)
3 {main}
thrown in /usr/local/apache/htdocs/replaceme/http/devK/linux/smppclient.class.php on line 621
Hi, Im trying to send SMS using the following code and got the exception as follows. Please help.
<?php require_once 'smppclient.class.php'; require_once 'gsmencoder.class.php'; require_once 'sockettransport.class.php';
// Construct transport and client $transport = new SocketTransport(array('my IP'),3700); $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","pass");
// 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 = 'this is a test'; $encodedMessage = GsmEncoder::utf8_to_gsm0338($message); $from = new SmppAddress(source,SMPP::TON_ALPHANUMERIC); $to = new SmppAddress(dest,SMPP::TON_INTERNATIONAL,SMPP::NPI_E164);
// Send $smpp->sendSMS($from,$to,$message,$tags);
// Close connection $smpp->close();
?> I have trying to connect the SMSC via SMPP3.4. Im having the smpp account with real ip/username/password. smpp account tested and working fine.
[root@linux]# php untitled.php Connecting to ip:3700... Connected to ip:3700! Binding transmitter... Send PDU : 44 bytes xxxxxxxx command_id : 0x2 sequence number : 1 Read PDU : 27 bytes xxxx command id : 0x80000002 command status : 0x0 No Error sequence number : 1 Binding status : 0 Send PDU : 70 bytes xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx command_id : 0x4 sequence number : 2 Read PDU : 16 bytes xxxxxxxxxxxxxxxxxxxxxxxxx command id : 0x80000004 command status : 0x1 Message Length is invalid sequence number : 2
Fatal error: Uncaught exception 'SmppException' with message 'Message Length is invalid' in /usr/local/apache/htdocs/replaceme/http/devK/linux/smppclient.class.php:621 Stack trace:
0 /usr/local/apache/htdocs/replaceme/http/devK/linux/smppclient.class.php(391): SmppClient->sendCommand(4, '???94785000735?...')
1 /usr/local/apache/htdocs/replaceme/http/devK/linux/smppclient.class.php(339): SmppClient->submit_sm(Object(SmppAddress), Object(SmppAddress), 'this is a test', NULL, 0)
2 /usr/local/apache/htdocs/replaceme/http/devK/linux/untitled.php(31): SmppClient->sendSMS(Object(SmppAddress), Object(SmppAddress), 'this is a test', NULL)
3 {main}
thrown in /usr/local/apache/htdocs/replaceme/http/devK/linux/smppclient.class.php on line 621