Create post with REST API in php with file_get_contents
Actually I have no problems getting posts. I need to create posts with the REST API in php with file_get_contents. This is my code: json_decode( file_get_contents( “http://my-site.com/wp-json/wp/v2/posts”, false, stream_context_create( array( “http” => array( “header” => “Content-type: text/json\r\n”, “method” => “POST”, “content” => json_encode( array( “slug” => “article-2”, “title” => “Article 2”, “content” => “Created with … Read more