gpt4 book ai didi

命令行中的 SMS Twilio API 错误但浏览器中没有错误但不发送消息

转载 作者:行者123 更新时间:2023-12-01 23:12:41 25 4
gpt4 key购买 nike

我让 twilio 工作了一段时间,但我想进行一些更改并将发送错误的数字保存在数据库中以避免再次发送它们,不知何故,Twilio 停止了工作。我从没有显示错误的浏览器中使用它,但是当我尝试从命令行运行脚本文件时出现这些错误。

感谢任何帮助。

PHP Notice:  Use of undefined constant CURLOPT_URL - assumed 'CURLOPT_URL' in /var/www/twilio/twilio-php-master/Twilio/Http/CurlClient.php on line 80
PHP Notice: Use of undefined constant CURLOPT_HEADER - assumed 'CURLOPT_HEADER' in /var/www/twilio/twilio-php-master/Twilio/Http/CurlClient.php on line 81
PHP Notice: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' in /var/www/twilio/twilio-php-master/Twilio/Http/CurlClient.php on line 82
PHP Notice: Use of undefined constant CURLOPT_INFILESIZE - assumed 'CURLOPT_INFILESIZE' in /var/www/twilio/twilio-php-master/Twilio/Http/CurlClient.php on line 83
PHP Notice: Use of undefined constant CURLOPT_HTTPHEADER - assumed 'CURLOPT_HTTPHEADER' in /var/www/twilio/twilio-php-master/Twilio/Http/CurlClient.php on line 84
PHP Notice: Use of undefined constant CURLOPT_TIMEOUT - assumed 'CURLOPT_TIMEOUT' in /var/www/twilio/twilio-php-master/Twilio/Http/CurlClient.php on line 85
PHP Notice: Use of undefined constant CURLOPT_HTTPHEADER - assumed 'CURLOPT_HTTPHEADER' in /var/www/twilio/twilio-php-master/Twilio/Http/CurlClient.php on line 89
PHP Notice: Use of undefined constant CURLOPT_HTTPHEADER - assumed 'CURLOPT_HTTPHEADER' in /var/www/twilio/twilio-php-master/Twilio/Http/CurlClient.php on line 89
PHP Notice: Use of undefined constant CURLOPT_HTTPHEADER - assumed 'CURLOPT_HTTPHEADER' in /var/www/twilio/twilio-php-master/Twilio/Http/CurlClient.php on line 89
PHP Notice: Use of undefined constant CURLOPT_HTTPHEADER - assumed 'CURLOPT_HTTPHEADER' in /var/www/twilio/twilio-php-master/Twilio/Http/CurlClient.php on line 89
PHP Notice: Use of undefined constant CURLOPT_HTTPHEADER - assumed 'CURLOPT_HTTPHEADER' in /var/www/twilio/twilio-php-master/Twilio/Http/CurlClient.php on line 93
PHP Notice: Use of undefined constant CURLOPT_POST - assumed 'CURLOPT_POST' in /var/www/twilio/twilio-php-master/Twilio/Http/CurlClient.php on line 106
PHP Notice: Use of undefined constant CURLOPT_POSTFIELDS - assumed 'CURLOPT_POSTFIELDS' in /var/www/twilio/twilio-php-master/Twilio/Http/CurlClient.php on line 107
PHP Fatal error: Call to undefined function Twilio\Http\curl_init() in /var/www/twilio/twilio-php-master/Twilio/Http/CurlClient.php on line 24


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Send SMS from parsed file</title>
</head>
<body>
<?php
ini_set("max_execution_time", 0);
$lines=array();
$fp=fopen('twilio_ready.csv', 'r');
while (!feof($fp)) {
$line=fgets($fp);
//Add +1 to the number
$line='+1'.$line;
//add to array
$lines[]=$line;
}
fclose($fp);
unset($lines[count($lines)-1]);
$people = array_flip($lines);

require_once __DIR__ . '/../twilio-php-master/Twilio/autoload.php'; // Loads the library
use Twilio\Twiml;
$servername = "localhost";
$username = "root";
$password = "lcrl62pk";
$dbname = "twilio";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);


use Twilio\Rest\Client;


$AccountSid = "Something here";
$AuthToken = "something here";

// Step 3: instantiate a new Twilio Rest Client
$client = new Client($AccountSid, $AuthToken);

foreach ($people as $number => $name) {
try {
$sms = $client->account->messages->create(

// the number we are sending to - Any phone number
$number,

array(
// Step 6: Change the 'From' number below to be a valid Twilio number
// that you've purchased
'from' => "+1844444444",

// the sms body
'body' => "hey there"
)
);

// Display a confirmation message on the screen
echo "<font color='green'>Sent message to $name at phone number: $number.</font>"."<br />";
} catch (Exception $e) {
echo "<font color='red'>Couldn't send message to $name at phone number: $number.</font>"."<br />";
//add them to black list database!
}
}



$conn->close();
print 'DONE!';
?>
</body>
</html>

最佳答案

sudo apt-get install php5-curl

重启服务器:

sudo service apache2 重启

关于命令行中的 SMS Twilio API 错误但浏览器中没有错误但不发送消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41493391/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com