wp_remote_post with ssl:// protocol

    $response = wp_remote_post( 'ssl://securesite.com', array(
        'method' => 'POST',
        'body' => $string, // variable is set
        'timeout' => apply_filters( 'http_request_timeout', 15),
        'sslverify' => true
    ));

    error_log(print_r($response, TRUE));

    if ( is_wp_error($response) ) {
        return FALSE;
    }

    $result = wp_remote_retrieve_body($response);

The result is an error:

[30-Aug-2011 21:53:53] WP_Error Object
(
[errors] => Array
    (
        [http_request_failed] => Array
            (
                [0] => Unsupported protocol: ssl
            )

    )

[error_data] => Array
    (
    )

)

If I use fsockopen and fgets everything works fine.

Read More

Seems like I’m missing an undocumented trick since ssl should be handled by wp_remote_post.

Related posts

Leave a Reply

2 comments

  1. This doesn’t seem to be error coming from WP itself, but is likely generated by curl, which WP likes to pick first for network requests.

    I’d try to replicate request with curl by hand on your hosting and elsewhere.

    If you are content with doing network request in other way you can tweak to make WP skip curl as transport and go for other options.