|
54 | 54 | print_r($kite->getPositions()); |
55 | 55 |
|
56 | 56 | // Place order. |
57 | | - $order_id = $kite->placeOrder([ |
| 57 | + $o = $kite->placeOrder([ |
58 | 58 | "tradingsymbol" => "INFY", |
59 | 59 | "exchange" => "NSE", |
60 | 60 | "quantity" => 1, |
61 | 61 | "transaction_type" => "BUY", |
62 | 62 | "order_type" => "MARKET", |
63 | 63 | "product" => "NRML" |
64 | | - ], "regular")["order_id"]; |
| 64 | + ], "regular"); |
65 | 65 |
|
66 | | - echo "Order id is ".$order_id; |
| 66 | + echo "Order id is ".$o->order_id; |
67 | 67 | </pre> |
68 | 68 |
|
69 | 69 | A typical web application |
@@ -108,7 +108,6 @@ class KiteConnect { |
108 | 108 | "api.token" => "/session/token", |
109 | 109 | "api.token.invalidate" => "/session/token", |
110 | 110 | "api.token.renew" => "/session/refresh_token", |
111 | | - "api.token.renew.invalidate" => "/session/refresh_token", |
112 | 111 | "user.profile" => "/user/profile", |
113 | 112 | "user.margins" => "/user/margins", |
114 | 113 | "user.margins.segment" => "/user/margins/{segment}", |
@@ -252,12 +251,12 @@ public function generateSession($request_token, $api_secret) { |
252 | 251 | "checksum" => $checksum |
253 | 252 | ]); |
254 | 253 |
|
255 | | - if(!empty($resp->access_token)) { |
| 254 | + if($resp->access_token) { |
256 | 255 | $this->setAccessToken($resp->access_token); |
257 | 256 | } |
258 | 257 |
|
259 | | - if(!empty($resp->last_time)) { |
260 | | - $resp->last_time = new DateTime($resp->last_time); |
| 258 | + if($resp->login_time) { |
| 259 | + $resp->login_time = new DateTime($resp->login_time); |
261 | 260 | } |
262 | 261 |
|
263 | 262 | return $resp; |
@@ -851,7 +850,7 @@ private function _request($route, $method, $params=null) { |
851 | 850 | } |
852 | 851 |
|
853 | 852 | // Prepare the payload. |
854 | | - $payload = http_build_query($params); |
| 853 | + $payload = http_build_query($params ? $params : []); |
855 | 854 | $headers = "Accept-Language: en-US,en;q=0.8\r\n" . |
856 | 855 | "Accept-Encoding: gzip, deflate\r\n" . |
857 | 856 | "Accept-Charset: UTF-8,*;q=0.5\r\n" . |
|
0 commit comments