Plivo PHP ライブラリを使用して、plivo 経由で SMS を送信しています。
ライブラリに正しい認証資格情報を設定していますが、curl_request メソッドのライブラリに従って base64 でエンコードされています。
ヘッダーは正しく、プラットフォームとの統合は正常に機能すると思いますが、send_message メソッドを使用して単純なメッセージを送信しようとすると、それを機能させることができず、常に応答ステータス 401 が返されます。これは、ドキュメントによると、認証のエラーです。 .
私は何を間違っていますか?
どうもありがとう
私のコード:
//Load library messages
$this->load->library( 'Plivo' );
$p = new RestAPI( 'MANXXXXXXXXXXXXXZIWOD', 'MmXXXXXXXXXXXXXXXXXXXXXXXXXXXX' );
// //for each phone Numbers generate password associated to event
foreach ( $nums as $key => $num ) {
//For each combo send Message
$params = array(
'src' => '13307782635', // Sender's phone number with country code (US)
'dst' => '447598XXXXXX', // Receiver's phone number with country code (UK)
'text' => 'Hi, Message from your fired', // Your SMS text message
'url' => site_url( 'eventPromotion/report' ), // The URL to which with the status of the message is sent
'method' => 'POST' // The method used to call the url
);
// Send message
$response = $p->send_message($params);
// Print the response
echo "Response : ";
var_dump( $response );