Advertisement
fahmihilmansyah

koptel test

Jun 4th, 2018
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1. <?php
  2.  
  3. $username = 'bumnceria';
  4. $password = 'pinku';
  5. $key='INGNE-123token-verifikator'; // token untuk akses masuk ke aplikasi
  6. $parma = json_encode(
  7.         array(
  8.             'username' => $username, // username yg di berikan untuk akses api
  9.             'password'=>$password, //password yg di berikan untuk akses api
  10.             //'request'=>'showdata', //action yg akan di request
  11.             'request'=>'get_pembiayaan', //action yg akan di request
  12.             'nik'=>'642003',
  13.             'norek'=>'6420035655',
  14.         )
  15.     );
  16. /*end konfigurasi post data*/
  17. /*konfigurasi header */
  18. $header = array(
  19.     'Auth: '.$key
  20.     );
  21. /*end konfigurasi header*/
  22. $ch = curl_init();
  23. curl_setopt($ch, CURLOPT_URL,"http://localhost/mobile2/public_html/apispengajuan/");
  24. curl_setopt($ch, CURLOPT_POST, 1);
  25. curl_setopt($ch, CURLOPT_POSTFIELDS,$parma);
  26. curl_setopt($ch, CURLOPT_HTTPHEADER,$header);
  27.  
  28. // receive server response ...
  29. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  30.  
  31. $server_output = curl_exec ($ch);
  32.  
  33. curl_close ($ch);
  34. if(!empty($server_output)){
  35. $serdecode = ($server_output);
  36.  
  37.  print_r($serdecode);
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement