Convert HTTP_Request2 to wp_remote_post

The issue might be with how you’re passing the XML data in the request body. In the wp_remote_post function try this” $xmlCustomerDataByAuthorLicenseID = ‘<GetCustomerDataByAuthor><AuthorID>ABC123</AuthorID></GetCustomerDataByAuthor>’; $response = wp_remote_post( $urlCustomerDataByAuthor, array( ‘method’ => ‘POST’, ‘headers’ => array( ‘Content-Type’ => ‘text/xml’ ), ‘body’ => $xmlCustomerDataByAuthorLicenseID, ‘sslverify’ => false ) ); if (wp_remote_success($response)) { $xmlDataParsed = simplexml_load_string($response[‘body’]); foreach ($xmlDataParsed->{“Customer”} … Read more

wp_remote_post() and Pem certificates

No, there are no provisions in wp_remote_post for those parameters. wp_remote_post is a high level abstraction around a deeper level API which itself is another wrapper around the Requests library ( which itself provides an abstraction that handles support for multiple HTTP backends, not all servers have curl, or the same versions of curl ). … Read more

wp_remote_post rabobank omnikassa (version2) – error 5001

turns out (in case it’s helpful to someone else) that $omnikassaOrder[‘signature’] = hash_hmac(‘sha512’, json_encode(implode(‘,’,$toHash)), base64_decode($SigningKey)); should have been simply the following (without json_encode ) $omnikassaOrder[‘signature’] = hash_hmac(‘sha512’, implode(‘,’,$toHash), base64_decode($SigningKey));

wp_remote_post code conversion

Use this code : $url=”https://xxxx.yyyyy.zzzzz”; $body_array = array( ‘object_type’ => ‘Leaderboard’, ‘action’ => ‘list’, ‘pagination’ => array( ‘limit’ => 5, ‘order’ => false ), ‘data’ => array( ‘username’ => ‘[email protected]’ ) ); $response = wp_remote_post( $url, array( ‘method’ => ‘POST’, ‘timeout’ => 45, ‘redirection’ => 5, ‘httpversion’ => ‘1.0’, ‘blocking’ => true, ‘headers’ => array( … Read more

WordPress wp_remote_post vs wp_remote_request

You should be able to use both wp_remote_request() and wp_remote_post() for a ‘POST’ request, as they are just wrappers for the same WP_Http::request method that supports the methods: ‘GET’, ‘POST’, ‘HEAD’, ‘PUT’, ‘DELETE’, ‘TRACE’, ‘OPTIONS’, ‘PATCH’. and the default one is ‘GET’. The difference is that wp_remote_post() function has the ‘POST’ method explicitly set via … Read more

wp_remote_post doesn’t work with more than 1024 bytes in the body

If you happen to be using the CURL transport, then it sometimes has minor problems sending POST requests greater than 1024 characters. More info here: https://stackoverflow.com/questions/463144/php-http-post-fails-when-curl-data-1024 The fix suggested there is to send an empty Expect: header. You can do this by modifying your code thusly: $response = wp_remote_post( $url, array( ‘timeout’ => 60, ‘redirection’ … Read more

Wp_remote_post not posting data

You’re passing request params incorrectly. Take a look at Codex page. You can find such example in there: $response = wp_remote_post( $url, array( ‘method’ => ‘POST’, ‘timeout’ => 45, ‘redirection’ => 5, ‘httpversion’ => ‘1.0’, ‘blocking’ => true, ‘headers’ => array(), ‘body’ => array( ‘username’ => ‘bob’, ‘password’ => ‘1234xyz’ ), ‘cookies’ => array() ) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)