<?php
$api_key = 'fb59f88534bd4c8e2559f885345trdbd81e4bd10';
$operator = 'smartfren';
$nominal = '20000';
$params = array(
'operator' => $operator,
'nominal' => $nominal
);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_FRESH_CONNECT => true,
CURLOPT_URL => 'https://api.ilenpay.co.id/v1/info/harga?' . http_build_query($params),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => ['Authorization: '.$api_key],
CURLOPT_FAILONERROR => false,
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4
]);
$response = curl_exec($curl);
$error = curl_error($curl);
curl_close($curl);
print_r(empty($error) ? $response : $error);
?>