<?php 

function novo_token($token){

	// $token = '08d73b71-cba4-4532-75a8-6d4f3e0e0808';
	$ch = curl_init("https://pwl.bvsnet.com.br/account/login?token=".$token);
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS,1);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_HEADER, 1);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER , 0);

	//Setando o cabeçalho
	$headers = [
		'X-Apple-Tz: 0',
		'Content-Type: application/json'
	];

	// Aplicando o cabeçalho na requisição
	curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

	$server_output = curl_exec($ch);
	$info		= curl_getinfo($ch);

	curl_close($ch);

	$server_output = explode('{', $server_output);

	$server_output = json_decode('{'.$server_output[1]);

	// var_dump($server_output);
	 return $server_output;
}
?>

