$url = ‘http://localhost/phalcon-api-oauth2/insertposts/’;

//Initiate cURL.
$ch = curl_init($url);

$atoken=’wCtmX4HC94yACOLVJVtufqG5C41RcbFHkq5wq2u4′;

$jsontoken= array(‘token’ => ‘wCtmX4HC94yACOLVJVtufqG5C41RcbFHkq5wq2u4’);

$jsonTokenEncoded = json_encode($jsontoken);

curl_setopt($ch, CURLOPT_HTTPHEADER,$jsontoken);

//The JSON data.
$jsonData = array(
// ‘token’ => ‘wCtmX4HC94yACOLVJVtufqG5C41RcbFHkq5wq2u4’,
‘name’ => ‘O345345’,
‘type’ => ‘mechanicalss’,
‘year’ => ‘1983’
);

//Encode the array into JSON.
$jsonDataEncoded = json_encode($jsonData);

//Tell cURL that we want to send a POST request.
curl_setopt($ch, CURLOPT_POST, 1);

//Attach our encoded JSON string to the POST fields.
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);

//Set the content type to application/json
curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’));

//Execute the request
echo $result = curl_exec($ch);

I m using this but i m getting this error. The request is missing an access token in either the Authorization header or the token request parameter.Please help