<?php error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE); function send_json($data){ $api_url = "https://rajabiller.fastpay.co.id/transaksi/json.php"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $api_url); curl_setopt($ch, CURLOPT_TIMEOUT, 0); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 500); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $result = curl_exec($ch); return $result; } $request_data = array( 'method' =>'rajabiller.balance', 'uid' =>'UID', 'pin' =>'PIN' ); $send_data = send_json($request_data); $respon = json_decode($send_data); echo $send_data; //json output response echo "<pre>", print_r($respon) ,"</pre>"; // untuk output array ?>