0

Hello i am building web app and i need to send post request using CURL to multiple pages at once, here is my basic example:

$ch = curl_init('http://mysite1 .com/page1.php'); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "id=$myid");
$hasil = curl_exec ($ch);
curl_close ($ch);

what i am trying to do is to send the same request to many pages at the same time for example: to mysite1 .com/page1.php,mysite2 .com/page1.php,mysite3 .com/page1.php etc anyone to help how to use curl multi exec to do this

  • you can build an array of sites and use `foreach` loop to do that. – Alex Dec 23 '14 at 13:57
  • Why do you asking it again? That was not an accident, that your previos post has closed: http://stackoverflow.com/questions/27619992/curl-sending-same-post-request-to-mutliple-pages-oce – vaso123 Dec 23 '14 at 13:58
  • possible duplicate of [understanding php curl\_multi\_exec](http://stackoverflow.com/questions/15559157/understanding-php-curl-multi-exec) – vaso123 Dec 23 '14 at 14:00
  • last post you asked it you got an answer: [curl-multi-init](http://php.net/manual/en/function.curl-multi-init.php) . you can also look at this (for multi-threading): [pthreads](http://php.net/manual/en/book.pthreads.php) – Noam L Dec 23 '14 at 14:02

0 Answers0