src/MVQN/REST/RestClient.php
public static function getMany(array $endpoints): array
    {
        // Create a cURL multi-session handler and an array to store each instance of the cURL sessions.
        $curl_handler = curl_multi_init();
        $curls = [];

        // Loop through each provided endpoint...
        for($i = 0; $i < count($endpoints); $i++)
        {
            // Create the cURL session.
            $curl = self::curl($endpoints[$i]);

            // Add the cURL session to the multi-session handler and store it in the array of sessions.
            curl_multi_add_handle($curl_handler, $curl);
            $curls[] = $curl;
        }

        $running = null;
        // Loop through and execute all of the cURL sessions in the multi-session handler...
        do curl_multi_exec($curl_handler, $running); while ($running);

        $responses = [];
        // Loop through each of the cURL sessions...
        for($i = 0; $i < count($curls); $i++)
        {
            // Get each session response and convert it to an associative array.
            $response = curl_multi_getcontent($curls[$i]);

            // Check to see if there were any errors...
            if(!$response)
                throw new \Exception("[MVQN\REST\ResClient] ".
                    "The REST request failed with the following error(s): ".curl_error($curls[$i]));

            //  Append the successful response to the array of responses.
            $responses[] = json_decode($response, true);

            // Then remove the cURL session from the multi-session handler.
            curl_multi_remove_handle($curl_handler, $curls[$i]);
        }

        // Close the cURL multi-session handler.
        curl_multi_close($curl_handler);

        // Finally, return the
        return $responses;
    }
public static function getMany(array $endpoints): array
    {
        // Create a cURL multi-session handler and an array to store each instance of the cURL sessions.
        $curl_handler = curl_multi_init();
        $curls = [];

        // Loop through each provided endpoint...
        for($i = 0; $i < count($endpoints); $i++)
        {
            // Create the cURL session.
            $curl = self::curl($endpoints[$i]);

            // Add the cURL session to the multi-session handler and store it in the array of sessions.
            curl_multi_add_handle($curl_handler, $curl);
            $curls[] = $curl;
        }

        $running = null;
        // Loop through and execute all of the cURL sessions in the multi-session handler...
        do curl_multi_exec($curl_handler, $running); while ($running);

        $responses = [];
        // Loop through each of the cURL sessions...
        for($i = 0; $i < count($curls); $i++)
        {
            // Get each session response and convert it to an associative array.
            $response = curl_multi_getcontent($curls[$i]);

            // Check to see if there were any errors...
            if(!$response)
                throw new \Exception("[MVQN\REST\ResClient] ".
                    "The REST request failed with the following error(s): ".curl_error($curls[$i]));

            //  Append the successful response to the array of responses.
            $responses[] = json_decode($response, true);

            // Then remove the cURL session from the multi-session handler.
            curl_multi_remove_handle($curl_handler, $curls[$i]);
        }

        // Close the cURL multi-session handler.
        curl_multi_close($curl_handler);

        // Finally, return the
        return $responses;
    }
Sends multiple HTTP GET Request to the specified endpoints of the base URL.

@param array $endpoints An array of endpoints to use for the multiple requests.
@return array Returns an associative array of the JSON results.
@throws \Exception Throws an exception if there were errors during the REST request/response phase.