Error 415 Supplied content type is not supported Using IBM Cloud document traslation

37 Views Asked by At
$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);

its gives Error:415 {\n "code": 415,\n "error": "Supplied content type is not supported."\n}" how to solve that issue

0

There are 0 best solutions below