I need to return JSON to the user with a “id” value. I also need to send that “id” to a client’s API.
Usually I have something like
$data = json_encode(array(“id”=“abc123”));
Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
return $data;
I’m not sure how to send a CURL request after that since I’ve already sent a return. I have read about EVENT_AFTER_SEND, but I’m not sure how to use it. I can’t find any examples either.