I need to send the same data to 10 remote servers.
I don't need the script to wait for a response from each server.
Here is an example using curl:
function post_data_by_curl($url, $data_array) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$url");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data_array));
curl_exec($ch);
}
$url = array(url1, url2, url3, url4, url5, url6, ...);
foreach ($url as $value) {
post_data_by_curl($value, $data_array);
}
In the foreach loop, I want each step to run in the background, so that slow servers don't hold up the script.
I don't care about a response from each remote server. I just want the process to start, run in the background, and then let php move on to the next server.