0

I am trying to get the result of one custom API in another custom API. Please help me with the same.

3
  • 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 Jun 29, 2018 at 4:13
  • What is the need of Both custom Api ? Jun 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 Jul 4, 2018 at 9:08

1 Answer 1

0

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));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.