<?php
// API endpoint
$url = "https://api.prestepay.com";
// POST data
$data = [
'API_key' => 'I2X48BKE-966QXYV-FVQA71-NSLEVLH-YBE0QV-GJ5BBQ330LEV',
'school_id' => '123',
'days' => '130'
];
// Initialize cURL session
$ch = curl_init($url);
// Set the options for the cURL session
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); // Convert the array to URL-encoded query string
// Execute the cURL request and get the response
$response = curl_exec($ch);
// Check for errors
if(curl_errno($ch)) {
$error = ['status' => 'error', 'message' => curl_error($ch)];
echo json_encode($error);
} else {
// Decode the JSON response
$result = json_decode($response, true);
// Return the result in JSON format
if ($result['status'] == 'success') {
echo json_encode(['status' => 'success', 'data' => $result['data']]);
} else {
echo json_encode(['status' => 'error', 'message' => $result['message']]);
}
}
// Close the cURL session
curl_close($ch);
?>