Class kiteConnect not found and GuzzleHttp not found in PHP Code

infotechc
infotechc edited January 2022 in PHP client
We have purchased the API. We want to implement it using the PHP. We have downloaded the php code from below url: https://github.com/zerodha/phpkiteconnect. Now the issue is that when we tried to use this code, its showing the erros like class kiteConnect not found and GuzzleHttp not found.
  • rakeshr
    You need to install phpkiteconnect client using composer, as explained here in the installation section.
  • infotechc
    Thanks @rakeshr. Checking from my side. Run exe file from the specific folder but issue still not resolved. Also one more thing is that its on the local machine. What need to do when upload the pages to the hosting server?
  • rakeshr
    Run exe file from the specific folder but issue still not resolved
    No, you don't have to create an executable(.exe) but .php file. Go through examples here.
  • infotechc
    Hi @rakeshhr, the issue got resolved. Thanks.

    We want live value of the stocks.

    So tried with print_r($kite->getQuote(["NSE:INFY", "NSE:SBIN"]));. This returns the proper value.

    But the issue is that token value is expired shortly and we created new token.

    In our case we need to get the live value of the stocks frequently. Is it working with this same code or any other apporach needs to be follow?

    Thanks in advance.
  • SRIJAN
    Use set_access_token method.
  • infotechc
    @SRIJAN: Thanks. Just wanted to confirm that we can get the quote frequently in the interval of seconds for couple of stocks? Is there any limitations for the same?
  • sujith
    @infotechc,
    You can refer to the FAQs for API rate limits.
  • infotechc
    Thanks @sujith.

    Hi, We achieved to get the current live stock price. For that followed below steps.
    1. Execute the script on the browser which we developed.
    2. It was showing "Authentication failed: Token is invalid or has expired." error
    3. We logged in manyally to get the request token
    4. Use request_token in the script and then it was working properly.

    How can we do it automatic way? I mean no need to manually login to get the request token.
    It sould be something like we get the request token through the script only and then use it in the script to get the quote of the stock.
  • sujith
    You can save the access token and use it throughout the day.

    It is mandatory by the exchange that a user has to manually login at least once a day. We don't recommend automating login.
  • infotechc
    Hi,

    Then no any scope to do the automated way without manually login? We need to give the solution to the client and it should be at automate way.
  • sujith
    As mentioned above, it is violation of the regulation to automate the login process.
This discussion has been closed.