Advertisement
joris

GABUNGAN KODE [Updated]

Sep 18th, 2012
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.83 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.  
  14.  
  15. $result = mysql_query("SELECT kode FROM tbl_channel") or die(mysql_error());
  16. while($data = mysql_fetch_array($result)){
  17.    
  18.     $DataKode = $data['kode'];
  19.        
  20. $client = new nusoap_client('http://118.97.88.27:81/TBISAPI/view/Epg.php');
  21. $result = $client->call('getSchedule', array('ChannelCode' => $DataKode, 'TglAwal' => $FormatEPG, 'TglAkhir' => $FormatEPG));
  22.  
  23. echo "<pre>" , print_r($result, 1) , "</pre>";
  24.  
  25. foreach($result as $row){
  26.     $ChannelCode        = $row['CHANNEL_CODE'];
  27.        
  28.     $ChannelName        = $row['CHANNEL_NAME'];
  29.     $ValidCN1       = strip_tags($ChannelName);
  30.     $ValidCN2       = str_replace("'","",$ValidCN1);
  31.        
  32.         $TglMulai               = $row['TGL_MULAI'];
  33.        
  34.         $WaktuMulai             = $row['WAKTU_MULAI'];
  35.         $FormatWM               = date('Y-m-d G:i:s',strtotime($WaktuMulai));
  36.        
  37.         $WaktuAkhir             = $row['WAKTU_AKHIR'];
  38.         $FormatWA               = date('Y-m-d G:i:s',strtotime($WaktuAkhir));
  39.        
  40.         $Judul                  = $row['JUDUL'];
  41.     $ValidJudul1        = strip_tags($Judul);
  42.     $ValidJudul2        = str_replace("'","",$ValidJudul1);
  43.        
  44.         $Sinopsis               = $row['SINOPSIS'];
  45.     $ValidSinopsis1     = strip_tags($Sinopsis);
  46.     $ValidSinopsis2     = str_replace("'","",$ValidSinopsis1);
  47.    
  48.     $query = "INSERT INTO epg (channel_code,channel_name,tgl_mulai,waktu_mulai,waktu_akhir,judul,sinopsis)
  49.     VALUES ('$ChannelCode','$ValidCN2','$TglMulai','$FormatWM','$FormatWA','$ValidJudul2','$ValidSinopsis2')";
  50.     mysql_query($query) or die(mysql_error());
  51.     }
  52.    
  53.    
  54. }
  55.  
  56.  
  57. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement