The request sample of an API is as follows:
{
"channel":"sms",
"source":"+1xxxxxxxx6",
"destination":[
"+1xxxxxxxx"
],
"content":{
"text":"Hey, Peter. It's Rick.",
"location":{
"longitude":"XX.9716",
"latitude":"XX.5946",
"label":"California",
"address":"Test Address"
},
"media":{
"url":"https://media.example.com/file",
"caption":"your media file"
}
},
"events_url":"https://events.example.com/message"
}
Being a newbie, I am having difficulty in setting up the setContent, i tried the following and it results in error:
->setChannel("XXXXXX")
->setSource("+XXXXXXX")
->setDestination(["+1XXXXXXXX"])
->setContent(["media"]["url"] => "https://Big_buck_bunny_poster_big.jpg",
"caption" => "My media file test"])
->setEventsUrl("example.com/events");
Error is as follows:
Error:
PHP Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ']' in
->setContent(["text" => "This is test message 3"]) works fine..
I know that this is something basic but being a newbie i can't figure it out. Requesting help.
UPDATE: Error in documentation