I am trying to get the result of one custom API in another custom API. Please help me with the same.
-
If I am giving the entity id of the product , the api will be resulted with sku...I need this result in another another api's method..that sku will be used by that method to give its result..do help me for the same– SUBBULAKSHMI GJun 29, 2018 at 4:13
-
What is the need of Both custom Api ?– Learing_CoderJun 29, 2018 at 14:53
-
Suppose I want to use the result of one api to input of another api...then i need two apis– SUBBULAKSHMI GJul 4, 2018 at 9:08
1 Answer
You can use curl or zend_client to call custom API from another API.
Note: This method is not recommended.
Curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = json_decode(curl_exec($ch));