Navigation

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

    Hrishi_95

    @Hrishi_95

    0
    Reputation
    1
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Hrishi_95 Unfollow Follow

    Latest posts made by Hrishi_95

    • Error in login in php

      Screenshot 2025-03-10 233546.png

      <form method='post' action=''>
            <input type="text" name="otp">
            <input type="submit" name="totp">
      
         </form>
      
      <?php
      if(isset($_POST['totp'])){
      $api_key = "";
      $client_id = "";
      //$client_secret = "YOUR_CLIENT_SECRET";
      $password = "";
      $totp = $_POST['otp']; // If enabled
      
      $state = "YOUR_STATE";
      $client_local_ip = "YOUR_CLIENT_LOCAL_IP";
      $client_public_ip = "YOUR_CLIENT_PUBLIC_IP";
      $mac_address = "YOUR_MAC_ADDRESS";
      
      // SmartAPI Login URL
      $login_url = "https://apiconnect.angelone.in/rest/auth/angelbroking/user/v1/loginByPassword";
      
      // Login Payload
      $login_data = [
          "clientcode" => $client_id,
          "password" => $password,
          "totp" => $totp,
          "state" => $state
      ];
      
      // Headers
      $headers = [
          "Content-Type: application/json",
          "Accept: application/json",
          "X-UserType: USER",
          "X-SourceID: WEB",
          "X-ClientLocalIP: $client_local_ip",
          "X-ClientPublicIP: $client_public_ip",
          "X-MACAddress: $mac_address",
          "X-PrivateKey: $api_key"
      ];
      
      // cURL Request
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $login_url);
      curl_setopt($ch, CURLOPT_POST, 1);
      curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($login_data));
      curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      $response = curl_exec($ch);
      curl_close($ch);
      
      // Handle Response
      $response_data = json_decode($response, true);
      print_r($response_data); // Prints API response
      
      }
      ?>
      
      

      please help me how to do the login with MPIN

      posted in General Discussion
      H
      Hrishi_95