Created
June 2, 2020 16:29
-
-
Save Sharifur/3dcd7293de2322693b9e5643347ec3ac to your computer and use it in GitHub Desktop.
wp_remote_post.php () example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$endpoint = 'api.example.com'; | |
$body = [ | |
'name' => 'Pixelbart', | |
'email' => 'pixelbart@example.com', | |
]; | |
$body = wp_json_encode( $body ); | |
$options = [ | |
'body' => $body, | |
'headers' => [ | |
'Content-Type' => 'application/json', | |
], | |
'timeout' => 60, | |
'redirection' => 5, | |
'blocking' => true, | |
'httpversion' => '1.0', | |
'sslverify' => false, | |
'data_format' => 'body', | |
]; | |
wp_remote_post( $endpoint, $options ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment