Advertisement
fahmihilmansyah

curls

Dec 13th, 2018
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. function run()
  2. {
  3.  
  4. $header = array(
  5. 'x-authorization: API_WEB_MITRA_COBA'
  6. );
  7. curl_setopt($this->initserver, CURLOPT_HTTPHEADER, $header);
  8. curl_setopt($this->initserver, CURLOPT_URL, $this->urls . $this->url_slug);
  9. curl_setopt($this->initserver, CURLOPT_POST, 1);
  10. curl_setopt($this->initserver, CURLOPT_POSTFIELDS, $this->params);
  11. curl_setopt($this->initserver, CURLOPT_RETURNTRANSFER, true);
  12. $server_output = curl_exec($this->initserver);
  13. $status_code = curl_getinfo($this->initserver, CURLINFO_HTTP_CODE);
  14. // echo $status_code;
  15. curl_close($this->initserver);
  16. // echo $server_output;
  17. //exit;
  18. if (!empty($server_output)) {
  19. $serdecode = json_decode($server_output, true);
  20. // print_r($serdecode);
  21. return $serdecode;
  22. }
  23. return false;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement