Sending curl requests in a loop?

0 like 0 dislike
8 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 | 8 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 1, 2019 by ivanburdin
110,608 questions
257,186 answers
0 comments
33,967 users