Multiple API Calls in a Class

后端 未结 3 736
情话喂你
情话喂你 2020-12-20 05:29

I am trying to make multiple API requests and I have to make the request in different functions that are within a class like so:

class exampleClass
{    
  f         


        
3条回答
  •  臣服心动
    2020-12-20 06:22

    You can use following class to achieve multiple API simultaneously/instantly/at once.

    Click here to get a class.

    How to use it?

    Step 1: Get object.

    //SANI: GET DATA    
    $obj = new multiapi();
    

    Step 2: Make a multiple GET Requests.

    $obj->data = array(YOUR_URL_1,YOUR_URL_2, OUR_URL_3);
    $result = $obj->get_process_requests();
    print_r($result);
    

    Step 3: Make a multiple HTTP POST Requests.

    //SANI: Request with params only
    $obj->data[0]['url']             = 'YOUR_URL_ONE';
    $obj->data[0]['post']                = array();
    $obj->data[0]['post']['param_1']     = 'param_value_1';
    $obj->data[0]['post']['param_2']     = 'param_value_2';
    

提交回复
热议问题