[ 'calculationID' => "ABC987" ], 'securityDefinition' => [ 'securityID' => 'Testsec77', 'paymentType' => 'Periodic', 'securityType' => 'Corporate', 'maturityDate' => '3/31/2031', 'couponRate' => 8.75, 'redemption_value' => 100.0, 'dayCountBasis' => 'SSCM30/360', 'eomRule' => 'Adjust', 'periodsPerYear' => 'Monthly', 'callRedemptions' => [ 'redemptionScheduleType' => 'Continuous with notification', 'notifyMinDays' => 30, 'notifyMaxDays' => 60, 'notifyStart' => 'Trade date', 'notifyCalendarBusiness' => 'Calendar days', 'redemptionList' => [ ['date' => '03/31/2027', 'value' => 101.50], ['date' => '09/30/2027', 'value' => 101.25], ['date' => '03/31/2028', 'value' => 101.0], ['date' => '09/03/2028', 'value' => 100.75], ['date' => '03/31/2029', 'value' => 100.50], ['date' => '09/30/2029', 'value' => 100.25] ] ] ], 'tradeDefinition' => [ 'tradeDate' => '7/22/2025', 'settlementDate' => '7/23/2025', 'givenType' => 'Price', 'givenValue' => 103.5 ], 'calculationSelection' => [ 'calcsToReturn' => [ 'calcPY' => "Yes", 'calcPYAnalytics' => "Yes", 'calcCFS' => "No", 'calcCFSAnalytics' => "Yes", 'calcCouponPeriod' => "Yes" ], 'calculationsFor' => "All redemptions" ], 'settings' => [ 'dateScheme' => [ 'dateTwoOrFourYear' => "FOUR", 'dateFormat' => 'MDY', 'dateCutoffYear' => 2075 ] ] ]; // 3. Initialize cURL $ch = curl_init($api_url); // 4. Set cURL Options curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload)); $headers = ['Content-Type: application/json']; if (!empty($api_key)) { $headers[] = 'X-API-KEY: ' . $api_key; } curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // 5. Execute API Call $response = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); // 6. Handle Response $is_cli = (php_sapi_name() === 'cli'); if (!$is_cli) echo "
";
if (curl_errno($ch)) {
echo "Curl Error: " . curl_error($ch) . "\n";
} else {
$decoded_response = json_decode($response, true);
echo "HTTP Status: $http_code\n";
if ($http_code === 200 && isset($decoded_response['success']) && $decoded_response['success']) {
echo "Status: SUCCESS\n\n";
print_r($decoded_response);
} else {
echo "Status: FAILED\n\n";
print_r($decoded_response);
}
}
if (!$is_cli) echo "";
// 7. Cleanup
curl_close($ch);
?>