使用WP API“代码问题”发布到WordPress

I am trying to post into a WordPress site using the WP API. I have the code below but it does not seem to be working, am not getting any post in my site.

<?php
$options  = array (
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'POST',
    'header' =>
    array (
    'Authorization' => 'Basic ' . base64_encode( 'user' . ':' . 'pass' ),
    ),
    'content' =>
     http_build_query(  array (
        'title' => 'Hello World',
        'content' => 'Hello. I am a test post. I was created by the API',
        'tags' => 'tests',
        'categories' => 'API',
      )),
  ),
);

$context  = stream_context_create( $options );
$response = file_get_contents(
    'http://freeglobaljob.com/wp-json/posts/',
    false,
    $context
);
$response = json_decode( $response );
?>