Skip to content

Instantly share code, notes, and snippets.

@nobodyplace
Last active July 10, 2019 08:21
Show Gist options
  • Select an option

  • Save nobodyplace/20f6344e0457ef6fee59bbc7cb55a38f to your computer and use it in GitHub Desktop.

Select an option

Save nobodyplace/20f6344e0457ef6fee59bbc7cb55a38f to your computer and use it in GitHub Desktop.
<?php
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://example.com/wp-json/wp/v2/'
]);
$client->post('posts',[
'auth' => [$user, $password],
'form_params' => [
'title' => 'WP REST API Example',
'content' => '<p>サンプル記事。Guzzle使用</p>',
'date' => '2019-07-10T20:00:00+09:00',
'status' => 'publish',
'featured_media' => 1234
],
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment