Jump to content


Photo

Multiple cURL sessions


  • Please log in to reply
5 replies to this topic

#1 freeloader

freeloader
  • Members
  • PipPipPip
  • Advanced Member
  • 175 posts

Posted 28 October 2006 - 10:29 AM

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?

#2 freeloader

freeloader
  • Members
  • PipPipPip
  • Advanced Member
  • 175 posts

Posted 29 October 2006 - 12:30 AM

Since this is the only topic noone else posted in... bump.

Anybody knows the answer?

#3 pendelton

pendelton
  • Members
  • PipPip
  • Member
  • 20 posts
  • LocationUK

Posted 29 October 2006 - 12:32 AM

What are you trying to acheive with you multiple cURL sessions?

#4 freeloader

freeloader
  • Members
  • PipPipPip
  • Advanced Member
  • 175 posts

Posted 29 October 2006 - 12:49 AM

Speed up the process... Having a session start at one side of the webpages it has to get through, and another session at the other.

#5 pendelton

pendelton
  • Members
  • PipPip
  • Member
  • 20 posts
  • LocationUK

Posted 29 October 2006 - 12:58 AM

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.




#6 freeloader

freeloader
  • Members
  • PipPipPip
  • Advanced Member
  • 175 posts

Posted 29 October 2006 - 01:20 AM

I'm not saying I don't want to use multi_init, I would just like to hear some explanation about it. How can I use it and will it do what I want (namely have two cURL functions launch at the same time - so not after each other).




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users