无法在 php 中使用 plivo api 发送短信

Unable to send sms using plivo api in php

我正在尝试在 PHP 中使用 Plivo API 发送短信,但是所有方法都工作正常并且也收到了 Plivo 的回复,但是我没有从所有这些方法中收到短信?

源代码1

# Plivo AUTH ID
$AUTH_ID = 'my id';
# Plivo AUTH TOKEN
$AUTH_TOKEN = 'my token';
# SMS sender ID.
$src = 'sender name';
# SMS destination number
$dst = '+92123456789';
# SMS text
$text = 'Hello';
$url = 'https://api.plivo.com/v1/Account/'.$AUTH_ID.'/Message/';
$data = array("src" => "$src", "dst" => "$dst", "text" => "$text");
$data_string = json_encode($data);
$ch=curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLOPT_USERPWD, $AUTH_ID . ":" . $AUTH_TOKEN);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$response = curl_exec( $ch );
curl_close($ch);
print_r($response);

源代码2

$auth_id = 'my auth id';
$auth_token = 'my token';
$src = 'sender number';
$dst = '+92123456789';

$text = 'Hello, this is testing message';

$api = curl_init("https://api.plivo.com/v1/Account/$auth_id/Message/");
curl_setopt_array($api, array(
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_POST => 1,
    CURLOPT_HTTPHEADER => array("Authorization: Basic ".base64_encode($auth_id.':'.$auth_token)),
    CURLOPT_POSTFIELDS => array(
        'src' =>$src,
        'dst' => $dst,
        'text' => $text
    )
));

$resp = curl_exec($api);

$resp = curl_exec($api);
curl_close($api);

var_dump($resp);

源代码3

require 'vendor/autoload.php';
use Plivo\RestClient;

$client = new RestClient("auth_id", "auth_token");
$response = $client->messages->create(
    'sender number', // Sender's phone number with country code
    ['+92123456789'], // receiver's phone number with country code
    "Hello, this is a sample text", // Your SMS text message        
    ["url"=>"http://test.com/plivoapi/"]
);
print_r($response);

我已经尝试了所有这些方法来发送 SMS 无法使用 Plivo 获取 SMS,即使我尝试使用不同国家/地区的号码获取 SMS

请指导我哪里做错了,或者我需要在 Plivo API 中添加一个 webhook URL 来发送短信?

从查找问题中的目标号码来看,它似乎是一个无效号码。如果您在这里仍然需要帮助,最好的选择是 create a support ticket.