'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6IjEzMDk2MDA1NCIsImVtYWlsIjoiMTMwOTYwMDU0X2ludCIsIm5iZiI6MTY0ODY1NzE0NSwiZXhwIjoxNjQ4NzA1NTY1LCJpYXQiOjE2NDg2NTcxNDV9.Fj1x0RA82rPaGJVaW8EyQoQ6EGEkj2dAuuU-Q8KtWqU', 'rnc' => '130960054', 'documento' => 'E310000003517', 'extension' => 'xml', ); //Se convierte en formato json $payload = json_encode($data); // Opciones headers curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); // Set contenido json en Body curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); // Retornar inmediatamente respueta curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Se ejecuta el PST $result = curl_exec($ch); $result2=json_decode($result); //Imprimimos resultado //print($result); echo "Los datos recibidos son los siguientes: "; echo "
"; foreach($result2 as $resul){ echo "
"; echo $resul; echo "
"; } // Se cierra el recurso curl_close($ch); ?>