Hello,
I'm having a problem with closing connections while looping curl. Basically what i need to do is get an array of id's from my MySQL database and loop curl with each of the id's which gives me an XML response and save the result back into my database. The problem i'm having is the gateway i'm requesting the data from will only take 5 simultaneous connections and if there is more than 5 it refuses my connection for a short period of time. I thought the below code would open, close the connection and therefor there would never be simultaneous connections. Please help.
Thanks in advance,
Justin.
while($I = mysql_fetch_array($GetSipIds)) {
$url = $Gateway;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_USERPWD, "username:password");
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $XPost);
$result = curl_exec($ch);
$xmlResponse = curl_exec( $ch );
** XML Parser Code **
** Insert the records into the database **
curl_close( $ch );
}