Im trying to get the data from the api server, not making REST API using yii2
yii has an extension called yii2-httpclient a good starting point, you can format your requests to json,xml and whole lot of other goodies
$client = new Client();
$apiRequest => $client->get('http://domain.com/api/resource'),
$response = $client->send($apiRequest);
Update: please note above example assumes you have yii2-httpclient installed and loaded, composer is your friend if you need to install yii2-httpclient
got the problem "Maximum execution time of 30 seconds exceeded"