I am placing an order via angelbroker smart api; but it returns empty response. Neither it returns Success nor error response.
Using following code to place an order:
$post_value_arr = array();
$post_value_arr = array(
"variety" => "NORMAL",
"tradingsymbol" => "SBIN-EQ",
"symboltoken" => "3045",
"exchange" => "NSE",
"quantity" => "1",
"transactiontype" => "BUY",
"ordertype" => "MARKET",
"producttype" => "MIS",
"duration" => "DAY"
);
$post_value_json = json_encode($post_value_arr);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://apiconnect.angelbroking.com/rest/secure/angelbroking/order/v1/placeOrder");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_value_json);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $auth_token, 'Content-Type: application/json', 'Accept: application/json', 'X-UserType: USER', 'X-SourceID: WEB', 'X-ClientPublicIP: 172.29.24.173', 'X-ClientLocalIP: 172.29.24.173', 'X-MACAddress: e0:d5:5e:91:23:d4', 'X-PrivateKey: ' . $api_key));
// receive server response ...
$server_output = curl_exec($ch);
$server_output_arr = json_decode($server_output, true);
Please check the code and suggest to rectify the issue.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…