How to integrate yii2 with third party api(Hosted on different Server)


(Yyshu18) #1

Im trying to get the data from the api server, not making REST API using yii2


(Alirz23) #2

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


(Yyshu18) #3

got the problem "Maximum execution time of 30 seconds exceeded"