我有一些代码使用twilio将用户注册到parse.com上的数据库。我想知道他们的电话号码是否已经在我的数据库中。我设置了一个查询来完成它。 find()方法搞砸了我的代码。它可以在我的本地主机上正常工作,但只要我在谷歌应用引擎上提供它就会引发异常? try / catch语句也没有帮助。有什么建议吗?
我是这个东西的总菜鸟。我根本不知道php / parse / twilio / google app引擎。我忘了图书馆还是什么?
<?php
require 'twilio-php/Services/Twilio.php';
require 'vendor/autoload.php';
use Parse\ParseClient;
use Parse\ParseObject;
use Parse\ParseQuery;
use Parse\ParseACL;
use Parse\ParsePush;
use Parse\ParseUser;
use Parse\ParseInstallation;
use Parse\ParseException;
use Parse\ParseAnalytics;
use Parse\ParseFile;
use Parse\ParseCloud;
date_default_timezone_set('America/Los_Angeles');
ParseClient::initialize('secret1','secret2', 'secret3');
$AccountSid = "secret4";
$AuthToken = "secret5";
$client = new Services_Twilio($AccountSid, $AuthToken);
$name = ($_REQUEST['Body']);
$from = ($_REQUEST['From']);
$query = new ParseQuery("RegisteredUsers");
$query->equalTo("PhoneNumber", (float)$from);
$results = $query->find();
$times = count($results);
echo $times;
$response = new Services_Twilio_Twiml();
$response->sms("Got your number in my database, $times times.");
echo $response;
$registeredUsers = new ParseObject("RegisteredUsers");
$registeredUsers->set("PhoneNumber", (float)$from);
$registeredUsers->set("GuestName", $name);
$registeredUsers->save();
?>