/** * Sends a POST request with the given article and bundles. * * @param string $url * @param string $article * @param array $bundles * @param array $meta * @return mixed * @since 0.2.0 */ public function post($url, $article, $bundles = array(), $meta = null) { // Assemble the content to send $content = $this->build_content($article, $bundles, $meta); // Build the post request args $args = array('headers' => array('Authorization' => $this->sign($url, 'POST', $content), 'Content-Length' => strlen($content), 'Content-Type' => 'multipart/form-data; boundary=' . $this->mime_builder->boundary()), 'body' => $content); // Allow filtering and merge with the default args $args = apply_filters('apple_news_post_args', wp_parse_args($args, $this->default_args)); // Perform the request $response = wp_safe_remote_post(esc_url_raw($url), $args); // Build a debug version of the MIME content for the debug email $debug_mime_request = $this->mime_builder->get_debug_content($args); // Parse and return the response return $this->parse_response($response, true, 'post', $meta, $bundles, $article, $debug_mime_request); }