I have page A with the following code to send a POST to page B:
function curlPost($url, $dados) {
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($dados));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
curl_close($curl);
return $response;
}
$executarPost = curlPost($url, $dados);
$resposta = json_decode($executarPost, true);
How do I send a JSON with some data from page B (page that received POST) to page A?