如何通过PLIVOAPI发送短信需要autoload.php

如何通过PLIVOAPI发送短信需要autoload.php,php,cakephp,plivo,Php,Cakephp,Plivo,如何通过plivoapi发送短信呢 需要供应商/autoload.php 但是我找不到任何autoload.php,它还有composer.json 当我运行时,这是get错误 找不到类“GuzzleHttp\Client” 这是我的密码 <form action="send_sms_from_browser.php" method="post"> From No:<input type="text" name="From"><br><br> To

如何通过plivoapi发送短信呢 需要供应商/autoload.php 但是我找不到任何autoload.php,它还有composer.json 当我运行时,这是get错误

找不到类“GuzzleHttp\Client”

这是我的密码

<form action="send_sms_from_browser.php" method="post">
From No:<input type="text" name="From"><br><br>
To&nbsp;&nbsp;&nbsp;&nbsp;No:<input type="text" name="To"><br><br>
Message:<br>
<textarea name="Text" rows="3" cols="30" >Message Text</textarea><br>     <br>
<input type="submit" value="Send SMS">
</form> 


error_reporting(E_ALL);
require_once 'vendor/autoload.php';
use Plivo\RestAPI;
$to = $_POST['To'];
$from = $_POST['From'];
$text = $_POST['Text'];
echo "<br/>Sent Message info:<br/><br/>To: $to<br/>";
echo "From: $from  <br/>";
echo "Message: $text <br/>";
$auth_id = 'Auth id';
$auth_token = "Token";

$p = new RestAPI($auth_id, $auth_token);

print_r($p);
// Send a message
$params = array(
        'src' => "$from",
        'dst' => "$to",
        'text' => "$text",
        'type' => 'sms',
    );
$response = $p->send_message($params);
echo $response[0];
if (array_shift(array_values($response)) == "202")
{
    echo "<br/><br/>Message status: Sent";
}
else
{
    echo "<br/><br/>Error: Please ensure that From number is a valid";
}

起始编号:

至否:

信息:
消息文本

错误报告(E_全部); 需要_once“vendor/autoload.php”; 使用Plivo\RestAPI; $to=$_POST['to']; $from=$_POST['from']; $text=$_POST['text']; echo“
发送消息信息:

至:$To
”; echo“From:$From
”; 回显“消息:$text
”; $auth_id='auth id'; $auth_token=“token”; $p=新重新启动PI($auth\u id,$auth\u令牌); 印刷费($p); //发送消息 $params=数组( 'src'=>“$from”, 'dst'=>“$to”, '文本'=>“$text”, '类型'=>'短信', ); $response=$p->send_message($params); echo$response[0]; if(数组移位(数组值($response))=“202”) { 回显“

消息状态:已发送”; } 其他的 { echo“

错误:请确保起始号码有效”; }
谢谢,现在我自己解决了这个问题,这是代码,希望这对你们有用

$ch = curl_init();
$data = '{"src": "source number with country code","dst": "receiver with country code", "text": "Hi, text from Plivo"}';


 curl_setopt($ch, CURLOPT_URL, "https://api.plivo.com/v1/Account/AUTH_ID/Message/");
 curl_setopt($ch, CURLOPT_POST, true);
 curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
 curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "Content-Type: application/json"
 ));


curl_setopt($ch, CURLOPT_USERPWD, "AUTH_ID:TOKEN_ID");
$result = curl_exec($ch);
print_r($result);exit;

欢迎来到SO。请看一看。您可能还需要检查、和以及如何创建。张贴您尝试过的代码和收到的错误。尽可能具体,因为这将导致更好的答案。