showtimesByTheaters($code_cine); } catch( ErrorException $error ) { die("Error retreiving informations (Err. n°". $error->getCode(). ") : ". $error->getMessage()); } try { $name_cine=null; $movies=array(); foreach($result->theaterShowtimes as $t) { $name_cine=$t->place->theater->name; foreach($t->movieShowtimes as $mst) { $movie=utf8_encode($mst->onShow->movie->title); $suf=array(); if ($mst->screenFormat['$']=='3D') { $suf[]='3D'; } if ($mst->version->code!=6001) { $suf[]='VO'; } if(count($suf)>0) { $movie.=' ('.implode('/',$suf).')'; } if (!isset($movies[$movie])) { $movies[$movie]=array(); } foreach($mst->scr as $day) { $date=DateTime::createFromFormat('Y-m-d',$day['d']); $jour=str_replace('.','',strftime('%a',$date->getTimestamp())); if(!isset($movies[$movie][$jour])) $movies[$movie][$jour]=array(); foreach($day['t'] as $t) { $movies[$movie][$jour][]=$t['$']; } } } } } catch( ErrorException $error ) { die("Error parsing informations (Err. n°".$error->getCode().") : ".$error->getMessage()); } // Format movies informations $fmovies=group_days($movies); // Calculate start/end of cine week $start_date=new Datetime(date('Y-m-d').' 00:00:00'); $start=$start_date->format('d/m'); $start_time=$start_date->getTimestamp(); $start_wd=(int)date('N',$start_time); $end_time=$start_time+(24*3600*((9-$start_wd)%7)); $end=date('d/m',$end_time); // Format Message $msg="Cinema $name_cine\nProgramme du $start au $end\n"; foreach($fmovies as $m => $ps){ $msg.="$m : "; $hss=array(); foreach($ps as $p => $hs) { $hss[]="$p ".implode(' & ',$hs); } $msg.=implode(' / ',$hss)."\n"; } // Remove accents $msg=$msg=withoutAccents($msg); if ($send_to && $mail_domain) { // Format mail $mail="$send_to@$mail_domain"; // Display message echo "Send to $mail :\n\n$msg"; // Send message mail($mail,'',$msg); } else { echo "$msg"; }