array( 'header' => array( "Content-type: application/json", "Authorization: Basic $auth", ), 'method' => 'POST', 'content' => json_encode($data) ) ); $context = stream_context_create($options); $result = file_get_contents($url, false, $context); if ($result === FALSE) { // Handle error } } } ?>