Jump to content

Multiple cURL sessions


freeloader

Recommended Posts

Hi guys,

I was wondering whether it was possible to have multiple cURL sessions launch at the same time. I found out about the multi_init function, but does it satisfy my needs, and if so: can somebody explain me how it works? Php.net haven't documented this function yet. Alternatively, is it possible to launch multiple functions at the same time?
Link to comment
https://forums.phpfreaks.com/topic/25388-multiple-curl-sessions/
Share on other sites

You could use a callback function and multiple curl_exec if you don't want to use multi_init. E.g.

$hCurl = curl_init();
curl_setopt($hCurl, CURLOPT_WRITEFUNCTION, 'TransactionResultCallback');
$Output = curl_exec($hCurl);

$hCurl2 = curl_init();
curl_setopt($hCurl2, CURLOPT_WRITEFUNCTION, 'TransactionResultCallback2');
$Output = curl_exec($hCurl2);

You will probably need to use a global variable to store the returned string in your callback functions.


Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.