我在使用 Infobip 短信网关时遇到问题。当我执行此代码时,我不知道下面的代码有一个名为 no HttpRequest class found 的错误。任何人请帮助我。
<?php
$request = new HttpRequest();
$request->setUrl('https://api.infobip.com/sms/1/text/single');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'accept' => 'application/json',
'content-type' => 'application/json',
'authorization' => 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
));
$request->setBody('{
"from":"InfoSMS",
"to":"41793026727",
"text":"Test SMS."
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}