发布数据时,wp_remote_post不会给出预期的行为

foreach ( $iContactData as $akey => $aval) {
        $post_items[] = $akey . '=' . $aval;
    }
    $post_string = implode ('&', $post_items);
    $url='https://app.icontact.com/icp/signup.php';
    $response = wp_remote_post( $url, array(
    'method' => 'POST',
    'timeout' => 45,
    'redirection' => 5,
    'httpversion' => '1.0',
    'blocking' => true,
    'headers' => array(),
    'body' => array( $post_string ),
    'cookies' => array()
    )
);

if( is_wp_error( $response ) ) {
   echo 'Something went wrong!';
} else {
   echo 'Response:<pre>';
   print_r( $response );
   echo '</pre>';
}

When I ran the test, it printed error. Seems like I might be wrong with array for body to post data to remote ?

insight will be appreciated. thanks

This isn't an awnswer to your issues but to help debug you should print the response even if it's an error. That will give you a proper error message.

so instead of this:

if( is_wp_error( $response ) ) {
   echo 'Something went wrong!';
} else {
   echo 'Response:<pre>';
   print_r( $response );
   echo '</pre>';
}

Simply use :

echo 'Response:<pre>';
print_r( $response );
echo '</pre>';