<?php

 // https://www.aqcm.fr/v2/OVH_API/send_SMS_1.php

require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

$endpoint = 'ovh-eu';
$applicationKey = "2730f57ecdb507a0";
$applicationSecret = "5950324d22a4da6e2a4761da31e1fc7f";
$consumer_key = "b6b80abb044d61e17332f49b968ef054";


$conn = new Api(    $applicationKey,
                    $applicationSecret,
                    $endpoint,
                    $consumer_key);

$smsServices = $conn->get('/sms');
foreach ($smsServices as $smsService) {

    print_r($smsService);
}

$content = (object) array(
    "charset"=> "UTF-8",
    "class"=> "phoneDisplay",
    "coding"=> "7bit",
    "message"=> "Bonjour les SMS OVH par api.ovh.com",
    "noStopClause"=> false,
    "priority"=> "high",
    "receivers"=> [ "+33761229502" ],
    "senderForResponse"=> true,
    "validityPeriod"=> 2880
);
$resultPostJob = $conn->post('/sms/'. $smsServices[0] . '/jobs', $content);

print_r($resultPostJob);

$smsJobs = $conn->get('/sms/'. $smsServices[0] . '/jobs');

print_r($smsJobs);

?>