0

hereから以下のコードを試しまし たが、HttpRequest クラスが見つからないというエラーがあります。私はphpバージョン5.6.8(xampp v3.2.1)を使用しています。誰でも私を助けてください。

<?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 sfdsdf=='  // name&password
));

$request->setBody('{  
   "from":"test",  //from
   "to":"000", // number
   "text":your verification code is = 000."
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
4

3 に答える 3

0
$mob_no="mobile number";
$msg="Your message";
$sender_id='your sender id eg:VJPOTPYTL';
$str = trim(str_replace(' ', '%20', $msg));

$url="http://dnd.9starabs.com/app/smsapi/index.php?key=55942cc305ef6&type=text&contacts=".$mob_no."&senderid=".$sender_id."&msg=".$str."";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_exec($ch);
curl_close($ch);
于 2015-12-02T06:51:11.767 に答える