• What I’m trying to do: Passing POST data by using wp_remote_post.

    foreach ( $articles as $article_id ) {
        $postarray = array(
        'method'        => 'POST',
        'timeout'       => 5,
        'redirection'   => 5,
        'httpversion'   => '1.0',
        'blocking'      => true,
        'headers'       => array(),
        'body'          => array(
            'article_id' => $article_id
            ),
        'cookies' => array()
        );
    
        $response = wp_remote_post($url, $postarray);
    
        if ( is_wp_error($response) ) {
            $error_message = $response->get_error_message();
            echo $error_message;
        } else {
            // the rest of my code here
        }
    }

    I’m working with 20+ posts per call. Everytime the loop finish, I get this error message:

    Operation timed out after 5001 milliseconds with 0 bytes received

    The strange thing is, the data are actually received and stored successfully on the designated $url server.

    Can anyone point me to the right direction, where should I look to avoid getting that error message?

    Reference: wp_remote_post

  • The topic ‘Error timed out with succesfull wp_remote_post’ is closed to new replies.