douqie3391
2015-07-30 02:09
浏览 46
已采纳

Twilio Media - 在非对象上调用成员函数get() - Twilio帮助程序库被破坏了吗?

Pretty much trying to do something exactly as defined in the examples on the Twilio REST API website.

https://www.twilio.com/docs/api/rest/media

In the examples, the following code deletes media in the account library.

$client->account->messages->get("MM800f449d0399ed014aae2bcc0cc2f2ec")->media->delete("ME557ce644e5ab84fa21cc21112e22c485");

and this code is supposed to return a list of the media assets associated with a specific message:

foreach ($client->account->messages->get('MM800f449d0399ed014aae2bcc0cc2f2ec')->media as $media) {
     echo $media->content_type;
 }

The problem is both of those examples return the error:

Call to a member function get() on a non-object

I'm not a PHP expert, and I've tried debugging this to the best of my capabilities. I am using the exact same call to $client->account->messages elsewhere in the script successfully, so I know that there is an object there, and can only assume the get() method is broken somehow.

I've read through the following but non seem to answer my issue:
Reference - What does this error mean in PHP?
PHP Error: "Call to member function create() on a non-object" Twilio code
calling to a member function create() on a non-object

Anyone with Twilio experience familiar with the issue here? Any way to at least confirm whether this is a PHP error on my part or is something wrong with the Twilio Media API, or the example code? Any and all help is appreciated.

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新