I've got a service that is calling a REST server. I'm using CURL to make the request. We have three endpoints to use for distributing the load. I could create some basic logic that would "randomly" pick an end point but that doesn't seem like a "good" solution. I'm wondering if there is a better solution?
define ("REST_SERVER", "http://myService.myCompany.com:8280");
...
$url = REST_SERVER.URL_SIGN;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$curl_result = curl_exec($ch);