Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $url = 'https://webservice.jogjakota.go.id/ws_pbb/index.php/univ-inquiry';
- $requestHeader = [
- 'Content-Type' => 'application/x-www-form-urlencoded',
- ];
- $requestBody = [
- 'token' => "22c56057e3e970a41c7027d6596ea5c8",
- 'nop' => "347101000100100130",
- 'tahun' => "2014",
- 'kdbank' => "10122601"
- ];
- $responseJson = CurlHelper::post($url, $requestHeader, $requestBody);
- $response = json_decode($responseJson, true);
- public static function post_json_proxy($url, $param, $getmessage=null){
- try {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLINFO_HEADER_OUT, true);
- curl_setopt($ch, CURLOPT_POST, true);
- if ($getmessage !=null){
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Authorization:Bearer ' .$getmessage ));
- }else{
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
- }
- curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- $rs = curl_exec($ch);
- curl_close($ch);
- } catch (Exception $ex) {
- $rs = $ex->getMessage();
- }
- return $rs;
- }
- $responseJson = self::post_json_proxy($url, $requestHeader, $requestBody);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement