0

Twilio をセットアップして、簡単な SMS を個人の電話に送信しようとしています。しかし、私が得るのはタイトルのこのエラーだけです+これは127行目のServices/Twilio/Resource.phpで発生します:

public function __toString() {
    $out = array();
    foreach ($this as $key => $value) {
        if ($key !== "client" && $key !== "subresources") {
            $out[$key] = (string)$value; <----------------HERE
        }
    }
    return json_encode($out);
}

コントローラー上の私のコードは次のようになります。

$client = new Services_Twilio($AccountSid, $AuthToken);
        try {
            foreach($listUsers as $user){
                $sms = $client->account->sms_messages->create(
                    $phone, // From this number
                    $user['phone'], // To this number
                    $message
                );
            }
            $data['results'] = "success";
            $data['message'] = "Your message have been sent successfully";
            echo json_encode($data);
        } catch (Services_Twilio_RestException $e) {
            $data['results'] = "error";
            $data['message'] = $e->getMessage();
            echo json_encode($data);
        }

私は今何時間も座っていますが、問題を理解できないようです. 誰かがこのTwilioを使用していて、少なくともどこを見ればいいのかヒントを教えてくれるかもしれません..

エラー全体:

PHP Catchable fatal error:  Object of class Services_Twilio_TinyHttp could not be converted to string in ../Services/Twilio/Resource.php on line 127, referer: 
4

2 に答える 2