SMS API - PHP Error
... / SMS API - PHP Error
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
Question

SMS API - PHP Error

by
CharlyJ2
Created on 2023-09-01 07:51:02 (edited on 2024-11-18 11:06:08) in SMS Pro

J'ai suivi la documentation complète sur les liens suivants :
- Doc OVH
- Repo

Tout est correctement mis en place :
- pris un forfait **1000 SMS/mois**.
- installé **composer require ovh/ovh**.
- généré applicationKey/applicationSecret/consumerKey à partir de ce lien : createToken
- j'ai également essayé d'utiliser l'API directement à partir d'OVH : API OVH

Voici le code :
public function test_global()
{
$applicationKey = getenv("OVH_KEY");
$applicationSecret = getenv("OVH_SECRET");
$consumerKey = getenv("OVH_CONSUME_KEY");
$endpoint = 'ovh-eu';

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

$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"=> [ "+33600000000" ],
"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);
}


1 Reply ( Latest reply on 2024-11-18 11:06:13 by
PierreV64
)

Bonjour, J'ai exactement le même problème. Avez-vous pu progresser sur le sujet. Bien cordialement.

bonjour @StephaneA56,
avez-vous pu trouver la solution ?
nous sommes également bloqués à cette étape
Merci