Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Curl timeout breaks script

    So im having difficulties with skipping timeout error in curl
    my script calls different functions my problem is lets say if in function2 is curl timeout error it wont continue with function3 but kills entire script. Is there any way to skip function2 (if there is timeout error) and continue with function3

    PHP Code:
    // Start calling functions

       
    function1();
       
    function2();
       
    function3();
       
    function4();
       
    function5(); 

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    you can control timeout, see the manual for curl_setopt, CURLOPT_TIMEOUT

    http://www.php.net/manual/en/function.curl-setopt.php

    you can use the return value to control the flow, see the manual for curl_exec, return values, for the rest of the question.

    http://www.php.net/manual/en/function.curl-exec.php

    best regards


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •