I want to make a post call with the following code:
function addWorkout() {
// url for workouts
$url = "https://jawbone.com/nudge/api/v.1.1/users/@me/workouts";
// set data to send
$data = http_build_query(array(
    'time_created' => intval($_GET['starttime']),
    'time_completed' => intval($_GET['endtime']),
    'sub_type' => intval($_GET['sport']),
    'calories' => intval($_GET['calories']),
));
var_dump($data);
$options = array(
    'http' => array(
        "header" => "Content-Type: Authorization: Bearer {$_COOKIE['access_token']}\r\n",
        'method' => 'POST',
        'content' => $data
    ),
);
var_dump($options);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump($result);
}
However it doesn't successfully make the post call. The following message appears: 
Warning: file_get_contents(https://...@me/workouts): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\wamp\www\FitnessWebApp\.idea\html\sport.php on line 90
Call Stack
#   Time    Memory  Function    Location
1   0.0006  280568  {main}( )   ..\sport.php:0
2   1.2201  293408  addWorkout( )   ..\sport.php:19
3   1.2204  296272  file_get_contents ( )   ..\sport.php:90
var_dump of $data:
string 'time_created=1368652731&time_completed=1368656325&sub_type=1&calories=333' (length=73)
var_dump of $options:
    array (size=1)
  'http' => 
    array (size=3)
      'header' => string 'Content-Type: Authorization: Bearer ...
' (length=166)
      'method' => string 'POST' (length=4)
      'content' => string 'time_created=1368652731&time_completed=1368656325&sub_type=1&calories=333' (length=73)
API documentation shows the following example:
POST https://jawbone.com/nudge/api/v.1.1/users/@me/workouts HTTP/1.1
Host: jawbone.com
time_created=1368652731&time_completed=1368656325&sub_type=3&calories=115
 
     
     
    