Hi, I want to get all the values that is coming from an apiurl. how can i do so here using yii2.
public function actionSuggestions()
{
$listingId = Yii::$app->request->get('listing_id');
$apiUrl = "example.com/asdga/hfdsu"
$suggestions = file_get_contents($apiUrl);
$suggestions = json_decode($suggestions, TRUE);
return $this->render('suggestions' , array(
'company_name' => $suggestions,
'listingId' => $listingId,
'suggestions' => $suggestions,
));
}
//In json format.
{
"tbl_supplierOrderDetails": [
{
"num": 1,
"user_id": 3496,
"priority": "A.closed",
"no_of_times": 5,
"username": "eyuw",
"company_name": "djff",
"email": "abc@gmail.com",
"contact_no": "9999999999",
"origin": "abc",
"dest": "xyz",
"vehicle_class": "abc,
"vehicle_type": "abc",
"notes": "TCS_"
}]
"tbl_userContactDetails": [
{
"user_id": 500,
"contact_name": "Mr abc",
"contact_email": "abc@gmail.com",
"contact_mobile": 9999999999,
"contact_mobile2": null
}]
}