Yii Framework Forum: How to integrate yii2 with third party api(Hosted on different Server) - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to integrate yii2 with third party api(Hosted on different Server) Im trying to get the data from the api server, not making RESTAPI

#1 User is offline   batzishu 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 22-November 17

Posted 22 November 2017 - 10:42 PM

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

#2 User is offline   alrazi 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,499
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 23 November 2017 - 12:14 AM

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
0

#3 User is offline   batzishu 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 22-November 17

Posted 23 November 2017 - 09:24 PM

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

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users