Advertisement
fahmihilmansyah

peruntikan detail

Jun 5th, 2018
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 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. 'u_key' => $username, // username yg di berikan untuk akses api
  9. 'p_key'=>$password, //password yg di berikan untuk akses api
  10. 'request'=>'get_peruntukan_detail', //action yg akan di request
  11. 'code_value'=>'MBA',
  12. )
  13. );
  14. /*end konfigurasi post data*/
  15. /*konfigurasi header */
  16. $header = array(
  17. 'Auth: '.$key
  18. );
  19. /*end konfigurasi header*/
  20. $ch = curl_init();
  21. curl_setopt($ch, CURLOPT_URL,"http://localhost/mobile2/public_html/apispengajuan/");
  22. curl_setopt($ch, CURLOPT_POST, 1);
  23. curl_setopt($ch, CURLOPT_POSTFIELDS,$parma);
  24. curl_setopt($ch, CURLOPT_HTTPHEADER,$header);
  25.  
  26. // receive server response ...
  27. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  28.  
  29. $server_output = curl_exec ($ch);
  30.  
  31. curl_close ($ch);
  32. if(!empty($server_output)){
  33. $serdecode = ($server_output);
  34.  
  35. echo($serdecode);
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement