'PHP error : HTTP request failed! HTTP/1.0 400 Bad Request

I call an API url with file_get_contents like this

$options_access_token = array(
                'http'=>array(
                  'ignore_errors' => true,
                  'method'=>"POST",
                  'header'=>"Authorization:Bearer mykey" 
                )
              );
              $context = stream_context_create($options_access_token);
              $access_token = file_get_contents($url_access_token, false, $context);
              print_r($access_token);exit;

it give a "HTTP request failed! HTTP/1.0 400 Bad Request" then i try ignore_errors' => true, on http request and it gave another error, it was "Client sent an HTTP request to an HTTPS server." the url is "http" protocol.

Any ideas what i do wrong or lacking? thanks for any answer it will be helpful



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source