creating form for wp_remote_post

You could make the form action be the current page’s URL. When the user submits the form the page gets reloaded with the POST parameters. Then in your widget’s code you check if those parameters exist. If so, you check them and then process them with your wp_remote_post. Personally I use Gravity Forms for stuff … Read more

Post body not working with wp_remote_post()

You’re setting the Content-Type header to application/json and wp_remote_post() doesn’t intelligently JSON-encode the request data (the body array), so you should manually do it. So for example: ‘body’ => json_encode( array( ‘Username’ => ‘myusername’, ‘Password’ => ‘mypassword’ ) )

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

How to set charset for wp_remote_post request?

After trying several times to set the proper charset, I wasn’t successful. Then I searched for an workaround and found one that worked with my problem. In addition to set the charset like I mentioned above, what I did is to convert all strings on my POST body with this php snippet: $message = @iconv(“UTF-8″,”Windows-1252//IGNORE”,$message); … Read more

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