Boa Noite,
Estou tentando consumir uma API no blank e esta mostrando essa mensagem: Atenção
file_get_contents() expects parameter 2 to be boolean, resource given
function geraContextoDoWs($data) {
$opts = array(‘http’ =>
array(
‘method’ => ‘POST’,
‘header’ => ‘Content-type: application/json; charset=utf-8’,
‘content’ => $data,
), “ssl” => array(
“verify_peer” => false,
“verify_peer_name” => false
)
);
return stream_context_create($opts);
}
function requisitaWsPost($url, $data) {
if ($url == "") {
throw new \Exception("URL não encontrada!");
}
return file_get_contents($url,$this->geraContextoDoWs($data));
}
$result = requisitaWsPost(‘https://www.site.com.br/’,'eu/1234567890’);
Aonde estou errando?