mms - Twilio - How to get media url from messages list? -
i using code list of messages received. media url of image if message mms message. can identify mms num_media property.
i don't know how media url. document says subresource_uris. not sure how use in case.
$client = new services_twilio($accountsid, $authtoken); $messages = $client->account->messages->getiterator(0, 5, array()) ; $media = ""; foreach($messages $sms) { if ($sms->num_media > 0) { } }
twilio developer evangelist here.
the media attached message can found querying media list resource message. that's nice , easy in php library need loop on media
resource $sms
message. so:
$client = new services_twilio($accountsid, $authtoken); $messages = $client->account->messages->getiterator(0, 5, array()) ; $media = ""; foreach($messages $sms) { if ($sms->num_media > 0) { foreach($sms->media $media) { echo $media->uri; } } }
let me know if helps!
Comments
Post a Comment