1. Go to this page and download the library: Download tamkeenlms/mobily-sms-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$client1 = new \MobilyAPI\Client('username1', 'password2', ['sender' => 'Tamkeen LMS']);
$client2 = new \MobilyAPI\Client('username2', 'password2', ['sender' => 'Tamkeen Company']);
// Create the request, under the $client1
$request = $client1->createRequest('sendingStatus');
// Send the request
$response = $request->send(); // (Returns a "Response" instance)
$serviceStatus = new \MobilyAPI\requests\SendingStatus( $client1 ); // Pass the client instance to the request class
$response = $serviceStatus->send();
$request = $client1->createRequest('sendingStatus'); // Create
$request->send(); // Send
var_dump( $request->available() ); // The method "available" returns boolean whether the service is up or not
$request = $client1->createRequest('sendSMS', ['0123456789'], 'Hi there!');
// The params
$request->getParams(); // ['numbers' => ['0123456789'], 'message' => 'Hi there!']// The response
$request->getResponse()->result(); // "message_sent"if($request->successful() && $request->sent()){
// Request made successfully, and the message was sent successfully!
}
// The request client
$request->getClient()->createRequest( ... )
(new Client(...))->request('SendSMS', ['0123456789'], 'Beep boop ...');
//Or
$client2->createRequest('SendingStatus')->getResponse()->available();
$serviceStatus = new \MobilyAPI\requests\SendingStatus( $client1 );
$response = $serviceStatus->send(); // Returns the Response
var_dump( $response->result() ); // "available"
var_dump( $response->raw() ); // "1"// Guzzle Response object
$response->object()->getStatusCode(); // "200" for example// A method available with the request
$request->available(); // Boolean (Notice using $request not $response)
$serviceStatus = new \MobilyAPI\requests\SendingStatus( $client1 );
$serviceStatus->send();
$serviceStatus->available(); // Available or not
$newSMS = new \MobilyAPI\requests\sendSMS( client, numbers, $message, $time, variableSets, messageId, sender, deletionKey );
$newSMS->send();
$newSMS->sent() // Boolea, marks whether the message was sent or not
$client->createRequest('SendSMS', ['0123456789', '9876543210'], 'I AM YOUR FATHER')->send();
$client->createRequest('SendSMS', ['0123456789'], 'Bazinga', '2016-12-31 00:00:00');
$client->createRequest('SendSMS', ['0123456789'], 'Stop googling your name!', Carbon::tomorrow()); // Send tomorrow the same time
$client->createRequest('SendSMS', ['0123456789'], 'Smilly cat, Smilly cat', Carbon::today()->addDays(3)); // 12 AM 3 days from now