[insert_php] $body = ”;
$url = “https://keybps.org/partner/api/response/cursos”;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);
curl_close($ch);
$result = $output;

$datos = array();
if(sizeof($result) > 0)
{
$datos = json_decode($result);

if($datos->message == ‘No existen cursos’)
{
$body .= ‘

No existen cursos disponibles en este momento

‘;

}
else
{

for($x = 0; $x < sizeof($datos); $x++) { //print_r($datos); if($datos[$x]->curso_estatus != ‘PRIVADO’)
{

$start_d = date( ‘l d, F, Y’, strtotime($datos[$x]->curso_fecha_a));
$final_d = date( ‘l d, F, Y’, strtotime($datos[$x]->curso_fecha_f));

$days = array(“Sunday”,”Monday”,”Tuesday”,”Wednesday”,”Thursday”,”Friday”,”Saturday”);
$dias = array(“Domingo”,”Lunes”,”Martes”,”Miercoles”,”Jueves”,”Viernes”,”Sábado”);
$months = array(“January”,”February”,”March”,”April”,”May”,”June”,”July”,”August”,”Septimber”,”October”,”November”,”December”);
$meses = array(“Enero”,”Febrero”,”Marzo”,”Abril”,”Mayo”,”Junio”,”Julio”,”Agosto”,”Septiembre”,”Octubre”,”Noviembre”,”Diciembre”);

$start_da = str_replace($days, $dias, $start_d);
$start_date = str_replace($months, $meses, $start_da);

$final_da = str_replace($days, $dias, $final_d);
$final_date = str_replace($months, $meses, $final_da);

$imagen = ”;

if($datos[$x]->curso_imagen != ”)
{
$imagen = ‘‘;
}

$interior = ”;

if($datos[$x]->curso_no_ext != ”)
{
$interior = ‘, ‘ . $datos[$x]->curso_no_ext;
}

$body .= ‘

‘ . $datos[$x]->curso_nombre . ‘

‘ . $start_da . ‘ ‘ . $datos[$x]->curso_tiempo_a . ‘
‘ . $final_da . ‘ ‘ . $datos[$x]->curso_tiempo_f . ‘

‘ . $imagen . ‘

‘;

$body .= ‘

‘ . $datos[$x]->curso_tipo . ‘

‘ . $datos[$x]->curso_desc . ‘

‘ . $datos[$x]->curso_ubicacion . ‘

Más Info

‘;[/insert_php]