curl hanging and preventing other site requests

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
patton
Forum Newbie
Posts: 2
Joined: Fri May 29, 2009 5:30 pm

curl hanging and preventing other site requests

Post by patton »

I'm using curl to retrieve an xml file, I neglected to put the timeout on curl and noticed when the xml file was unreachable curl would keep trying until the php timeout I guess, but during that time other requests for other files on the site would hang while the curl was processing.

I fixed this by setting a timeout on curl like:
curl_setopt($curl_session, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_session, CURLOPT_TIMEOUT, 4);

I don't really understand what was happening beforehand, does anyone know?
Post Reply