Sending curl requests in a loop?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
12 views
Good afternoon. The question arose when working with the curl of Ohm: how to send requests in a loop, namely: whether it is necessary to open and close the session on each iteration or it has to be done outside the loop?

// open from outside $curl = curl_init(); foreach ($paramArray as $param) { // or iteration $curl = curl_init(); $url = "http://domain.com/script.php?param=" . $param; curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => true, CURLOPT_URL => $url, )); $response = curl_exec($curl); // also close curl_close($curl); } // also close curl_close($curl);
by | 12 views

1 Answer

0 like 0 dislike
by

Related questions

0 like 0 dislike
2 answers
asked Apr 11, 2019 by dmitrybascacov
0 like 0 dislike
2 answers
asked Jun 4, 2019 by maiskiykot
0 like 0 dislike
2 answers
asked May 12, 2019 by NikHaker
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked May 2, 2019 by ivanburdin
110,608 questions
257,186 answers
0 comments
35,573 users