Adam Wright
Adam Wright

Reputation: 37

Increase curl timeout for busy servers

I've increased the timeout but it doesn't work.

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://localhost.com/test.php");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 999);
    $response = curl_exec($ch);
    print_r($response);

Upvotes: 2

Views: 185

Answers (1)

digiogi
digiogi

Reputation: 270

You need to add CURLOPT_CONNECTTIMEOUT option to it.

curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 600); //10 minutes

Upvotes: 4

Related Questions