<?php
defined("BASEPATH") or exit("No direct access allowed");
?>
<div class="section-header">

<div class="card-header">
    
          <nav aria-label="breadcrumb">
                      <ol class="breadcrumb bg-warning text-white-all">
                        <li class="breadcrumb-item"><a href="#"><i class="fas fa-tachometer-alt"></i> Home</a></li>
                        <li class="breadcrumb-item"><a href="#"><i class="far fa-file"></i> API</a></li>
                        <li class="breadcrumb-item active" aria-current="page"><i class="fas fa-list"></i> Script</li>
                      </ol>
                    </nav>

    <div class="card-body">
            <div class="alert alert-primary alert-has-icon p-4">
            <div class="alert-icon"><i class="far fa-lightbulb"></i></div>
            <div class="alert-body">
            <div class="alert-title">Petunjuk:</div>
            1. Script API ini dipasang pada Aplikasi web anda. <br>
            2. Script API ini berfungsi untuk menyimpan dan menampilkan data prospek.<br>
            3. Sesuikan dengan kondisi/aksi yang diinginkan pada aplikasi web anda.<br>
            4. Diperuntukkan bagi yang ngerti pemrograman PHP atau developer web.
            </div>
            </div>
        </div> 
  
<div class="card-body">	
    <?php
        echo '
        <h4>1). Simpan Data Prospek </h4><br>
        Simpan Script API ini dengan nama fungsi.php 
        <div style="background:#020d12;padding:10px;border:1px solid #000000">
        <font color="white">
        <!-- function autobiznistop($nama, $email, $hp, $grup) { <br>
            $url = "'.$weburl.'/api.php?nama=" . $nama . "&email=" . $email . "&hp=" . $hp . "&grup=" . $grup; <br>
            $ch = curl_init(); <br>
            $optArray = array( <br>
                    CURLOPT_URL => $url, <br>
                    CURLOPT_RETURNTRANSFER => true <br>
            ); <br>
            curl_setopt_array($ch, $optArray); <br>
            $result = curl_exec($ch); <br>
            curl_close($ch); <br>
        } -->
        
        function autobiznistop($nama, $email, $hp, $grup) { <br>
        $curl = curl_init(); <br>
    
        $data = [ <br>
            &#039;nama&#039; =&gt; $nama, <br>
            &#039;email&#039; =&gt; $email,<br>
            &#039;hp&#039; =&gt; $hp, <br>
            &#039;grup&#039; =&gt; $grup, <br>
        ];
        <br>
        curl_setopt($curl, CURLOPT_CUSTOMREQUEST, &quot;POST&quot;);<br>
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);<br>
        curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));<br>
        curl_setopt($curl, CURLOPT_URL, &quot;'.$weburl.'/api.php&quot;);<br>
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);<br>
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);<br>
        $result = curl_exec($curl);<br>
        curl_close($curl);<br>
        echo &quot;&lt;pre&gt;&quot;; <br>
        print_r($result); <br>
        }<br>
        
        </font></div>
        
        Simpan Script API ini dengan nama kirim.php atau sisip diantara algoritma yang sudah dibuat 
        <div style="background:#020d12;padding:10px;border:1px solid #000000">
        <font color="white">
            include "fungsi.php"; <br>
        	$nama = <font color="yellow">"Yanto"</font>; <br>
        	$email = <font color="yellow">"yantoit2011@yahoo.co.id"</font>; <br>
        	$hp = <font color="yellow">"082150651122"</font>; <br>
        	$grup = <font color="yellow">"1"</font>; <br>
        	autobiznistop($nama, $email, $hp, $grup); </font></div>
        Grup diisi dengan Nomor Grup,cek pada List Grup	<hr>
        Respon JSON:
        <div style="background:#020d12;padding:10px;border:1px solid #000000">
        <font color="white">
            {"error":true,"pesan":"data sudah ada atau ID grup tidak terdaftar"}<br> atau <br>
            {"error":false,"pesan":"Sukses menyimpan data"}	
        </font></div>
        <hr>
        <h4>2). Tampilkan Data Prospek </h4><br>
        <b>URL API:</b> 
        <div style="background:#020d12;padding:10px;border:1px solid #000000">
        <font color="white">
            '.$weburl.'/kirim1.php?grup=</font><font color="yellow">[Nomor Grup]</font><font color="white">&ver='.$lisensi.'</font>
        </div>
        Ganti Nomor Grup sesuai di List Grup. Akan tampil data Json seperti ini:
        <div style="background:#020d12;padding:10px;border:1px solid #000000">
        <font color="white">
            {"prospek":[{"ID":"8","nama":"Edy pay","email":"edypay212@gmail.com","hp":"085746768105","tgl_gabung":"2019-08-25 21:48:59","kirim":"4","baca":"11","gagal":"0"},{"ID":"16","nama":"Yanto","email":"yantoit2011@yahoo.co.id","hp":"082150651122","tgl_gabung":"2019-09-20 23:40:03","kirim":"1","baca":"0","gagal":"0"},{"ID":"18","nama":"Yanto","email":"ytxbangkep2011@gmail.com","hp":"082150651122","tgl_gabung":"2019-09-26 21:01:40","kirim":"0","baca":"0","gagal":"0"}]}
        </font></div>
        Lakukan Decode Json dan sesuaikan dengan algoritma yang sudah anda buat sebelumnya.
        <hr>
        <h4>3). Tampilkan Data Grup </h4><br>
        <b>URL API:</b> 
        <div style="background:#020d12;padding:10px;border:1px solid #000000">
        <font color="white">
            '.$weburl.'/kirim2.php?</font><font color="white">ver='.$lisensi.'</font>
        </div>
        Akan tampil data Json seperti ini:
        <div style="background:#020d12;padding:10px;border:1px solid #000000">
        <font color="white">
            {"grup":[{"ID":"1","nama":"Demo Produk A","jml":"1"},{"ID":"2","nama":"Demo Produk B","jml":"1"}]}
        </font></div>
        Lakukan Decode Json dan sesuaikan dengan algoritma yang sudah anda buat sebelumnya.
        <hr>
        <h4>4). Merubah Status Prospek Menjadi Buyer </h4><br>
        Simpan Script API ini dengan nama fungsi.php 
        <div style="background:#020d12;padding:10px;border:1px solid #000000">
        <font color="white">
        
        function ubahautobiznistop($email,$grup) { <br>
        $curl = curl_init(); <br>
    
        $data = [ <br>
            &#039;email&#039; =&gt; $email,<br>
            &#039;grup&#039; =&gt; $grup,<br>
        ];
        <br>
        curl_setopt($curl, CURLOPT_CUSTOMREQUEST, &quot;POST&quot;);<br>
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);<br>
        curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));<br>
        curl_setopt($curl, CURLOPT_URL, &quot;'.$weburl.'/api2.php&quot;);<br>
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);<br>
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);<br>
        $result = curl_exec($curl);<br>
        curl_close($curl);<br>
        echo &quot;&lt;pre&gt;&quot;; <br>
        print_r($result); <br>
        }<br>
        
        </font></div>
        ';
    
    ?>
                
 </div>
           