Advertisement
joris

EPG

Sep 18th, 2012
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.65 KB | None | 0 0
  1. <?php
  2. date_default_timezone_set("Asia/Jakarta");
  3. require_once('lib/nusoap.php');
  4. require_once('koneksi.php');
  5.  
  6. $WaktuAsli = date("Y-m-d");
  7. $Potong = explode('-',$WaktuAsli );
  8. $FormatEPG = $Potong[0].$Potong[1].$Potong[2];
  9.  
  10. $Hapus = "truncate table epg";
  11. mysql_query($Hapus) or die(mysql_error());
  12.  
  13. $client = new nusoap_client('http://118.97.88.27:81/TBISAPI/view/Epg.php');
  14. $result = $client->call('getSchedule', array('ChannelCode' => 'HBO', 'TglAwal' => $FormatEPG, 'TglAkhir' => $FormatEPG));
  15.  
  16. echo "<pre>" , print_r($result, 1) , "</pre>";
  17.  
  18. foreach($result as $row){
  19.     $ChannelCode        = $row['CHANNEL_CODE'];
  20.        
  21.     $ChannelName        = $row['CHANNEL_NAME'];
  22.     $ValidCN1       = strip_tags($ChannelName);
  23.     $ValidCN2       = str_replace("'","",$ValidCN1);
  24.        
  25.         $TglMulai               = $row['TGL_MULAI'];
  26.        
  27.         $WaktuMulai             = $row['WAKTU_MULAI'];
  28.         $FormatWM               = date('Y-m-d G:i:s',strtotime($WaktuMulai));
  29.        
  30.         $WaktuAkhir             = $row['WAKTU_AKHIR'];
  31.         $FormatWA               = date('Y-m-d G:i:s',strtotime($WaktuAkhir));
  32.        
  33.         $Judul                  = $row['JUDUL'];
  34.     $ValidJudul1        = strip_tags($Judul);
  35.     $ValidJudul2        = str_replace("'","",$ValidJudul1);
  36.        
  37.         $Sinopsis               = $row['SINOPSIS'];
  38.     $ValidSinopsis1     = strip_tags($Sinopsis);
  39.     $ValidSinopsis2     = str_replace("'","",$ValidSinopsis1);
  40.    
  41.     $query = "INSERT INTO epg (channel_code,channel_name,tgl_mulai,waktu_mulai,waktu_akhir,judul,sinopsis)
  42.     VALUES ('$ChannelCode','$ValidCN2','$TglMulai','$FormatWM','$FormatWA','$ValidJudul2','$ValidSinopsis2')";
  43.     mysql_query($query) or die(mysql_error());
  44. }
  45. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement