I need to send the same data to 10 remote servers.
I dont 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 dont hold up the script.
I dont 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.
I need to send the same data to 10 remote servers.
I dont 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 dont hold up the script.
I dont 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.
|
|
Search Webmaster Help and Solution
Asynchronous/parallel postRelated ItemsQuery failed: connection to localhost:3354 failed (errno=111, msg=Connection refused). |
