Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs
    1. Home
    2. helena3608042
    3. Posts
    H
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by helena3608042

    • Login issue PHP curl

      I am trying to login but it keep on giving me error code 400. Not sure why? Below is my code
      Also in header I am not sure what to set as MAC IP as I don't hold mac and in client local ip I am adding my system local IP and in client public ip I am adding my server ip where my website is located.
      I hope i am doing it right..

      $headers = array('Content-Type: application/json', 'Accept: application/json', 'X-UserType: USER', 'X-SourceID: WEB', 'X-ClientLocalIP: 182.69.96.96', 'X-ClientPublicIP: 185.28.21.157', 'X-MACAddress: MYMACIP', 'X-PrivateKey: MYPRIVATEKEY');

          $data["clientcode"] = "MYCLIENTCODE";
          $data["password"] = "PASSWORD";
      
          $url = 'https://apiconnect.angelbroking.com/rest/auth/angelbroking/user/v1/loginByPassword';
      
          $jsonData = json_encode($data);
      
          $curl = curl_init();
          curl_setopt($curl, CURLOPT_POST, 1);
          curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
          curl_setopt($curl, CURLOPT_HEADEROPT, CURLHEADER_UNIFIED);
          curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
      
          curl_setopt($curl, CURLOPT_URL, $url);
          curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
              
          $result = curl_exec($curl);
          $http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
      
          echo '<br/>Response Status : ' . $http_status;
          echo '<br/>Response String : ' . $result;
      
          //To Convert json response to array
          $resJsonArray = json_decode($result, true);
      

      Response I am receiving is

      Response Status : 400
      Response String :

      posted in General Discussion
      H
      helena3608042
    • PHP LTP API

      Hey
      I am using smart API in the PHP platform
      Everything is okay but I am a little lost to identify which API should I call to get the live trading data of NFO (Only for NFO)
      There is not much written in the documentation.
      Can you help me?
      May be it is something related to LTP but I am not sure how to call it through PHP

      Thank you in advance!

      posted in General Discussion
      H
      helena3608042