Advertisement
Guest User

Untitled

a guest
Aug 7th, 2018
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. <?php
  2.  
  3. class Model_mahasiswa extends CI_Model {
  4.  
  5.  
  6. Function getdata ()(
  7.  
  8.  
  9. $url = "http://10.11.4.34/mahasiswa/index_get?nama="._GET["nama"];
  10.  
  11. $ch = curl_init();
  12.  
  13. curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
  14.  
  15. curl_setopt($ch,CURLOPT_URL,$url);
  16.  
  17. $result=curl_exec($ch);
  18.  
  19. curl_close($ch);
  20.  
  21. var_dump(json_decode($result,true)); ---------> buat decode datanya
  22.  
  23.  
  24. $key = $result; ---> buat tammpung hasil bener ga ?
  25.  
  26. Foreach($key as $hasil => $value) { ----------> buat looping , tapi masih invalid foreach
  27.  
  28. $ret[$h] = trim($value);
  29. }
  30. )
  31. }
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement