Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //unlink('sudah.txt');
- $data = file_get_contents('bersih.txt');
- $pecah = explode('|',$data);
- $sudah = file_get_contents('sudah.txt');
- $myfile = fopen("sudah.txt", "w") or die("Unable to open file!");
- $jumlah = substr_count($sudah,'|');
- $tambah = $jumlah+100;
- //echo 'jumlah | = '.$jumlah.' jumlah+10 = '.$tambah.'<br/>';
- for ($x = $jumlah; $x <= $tambah; $x++) {
- $pecah[$x] = str_replace('|','',$pecah[$x]);
- if(substr_count($sudah,''. $pecah[$x].'|')>0){
- //tidak tulis dan tidak eksekusi karena lebih 0 sudah ada di udah.txt
- //echo ''.$pecah[$x].' sudah ada di sudah.txt<br/>';
- $txt = "";
- fwrite($myfile, $txt);
- }
- else {
- //jika belum ada maka jalanka untuk tambah ke sheet dan tulis ke sudah.txt
- //echo ''.$pecah[$x].' belum ada<br/>';
- $txt = "".$pecah[$x]."|";
- // $ch = curl_init("https://script.google.com/a/sman-modalbangsa.sch.id/macros/s/AKfycbxnFvNqcwftcO_cymNzkhaGTQgyKEJKKeoFdJlGLNSJ/dev?bali="+$pecah[$x]+"");
- // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- // curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
- // $content = curl_exec($ch);
- // curl_close($ch);
- // echo $content;
- $go = file_get_contents("https://script.google.com/a/sman-modalbangsa.sch.id/macros/s/AKfycbxnFvNqcwftcO_cymNzkhaGTQgyKEJKKeoFdJlGLNSJ/dev?bali="+$pecah[$x]+"");
- fwrite($myfile, $txt);
- $pecah[$x] = str_replace(' ','_',$pecah[$x]);
- $pecah[$x] = ucfirst($pecah[$x]);
- echo ''.$pecah[$x].'|';
- }
- }
- $txt = "".$sudah."";
- fwrite($myfile, $txt);
- fclose($myfile);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement