<?php

// URL of the PHP page
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https://' : 'http://';
$url = $protocol . $_SERVER['HTTP_HOST'] . '/payment/widthdaw.php';

// Data to be sent in the POST request
$data = array(
    'name' => '1234567890',
    'user_token' => '64f06fc9c26552c69d7ed4eba3459e1e',
    'amount' => '10',
'ifsc' => '1234567890',
    'order_id' => '123456'.time(),
    'Ac_or_upi' => '00000000000000000',
    'note' => 'test1',
    'type' => 'UPI',
);

// Initialize cURL session
$ch = curl_init();

// Set cURL options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute cURL session and store the response
echo $response = curl_exec($ch);

// Check for cURL errors
if (curl_errno($ch)) {
    echo 'cURL Error: ' . curl_error($ch);
}

// Close cURL session
curl_close($ch);



// Check if decoding was successful
if ($response !== null) {
    
    
    // Redirect the user to the payment URL
  
    
} else {
    echo 'Failed to decode JSON response.';
}
?>