首页 > 解决方案 > 错误 415 不支持提供的内容类型使用 IBM Cloud 文档翻译

问题描述

$auth = base64_encode( 'apikey:' . $apikey );
$endpoint          = $url . '/v3/documents?version=2018-05-01';
$filename          = ABSPATH.'wp-content/uploads/sample.pdf';
$filetype = wp_check_filetype('sample.pdf');
$response=wp_remote_post(
    $endpoint,
    array(
            'body'    => array(
                         'file' => '@' .$filename,
                        'source' => $source_lang,
                        'target' => $target_lang,
                    ),
    "headers"  => array(
        'Authorization' => 'Basic ' . $auth,
        'content-type' => $filetype['type'],
           
     )
    )
);

print_r($response);

它给出了 Error:415 {\n "code": 415,\n "error": "Supplyed content type is not supported."\n}" 如何解决该问题

标签: wordpressibm-cloud-private

解决方案


推荐阅读