The following code is written for Yii2 framework, but except for the first line of the function that fetches the path to the root directory of project, it works with other PHP frameworks or without a framework.
Ticker is where you specify the Scrip ID of the stock , be it IRCTC, JSL, TATAMOTORS etc. You should use both the exchange symbol and scrip id seperated by a colon to avoid ambiquity. For example, if you are fetching data of IRCTC stock from NSE, ticker parameter should be NSE:IRCTC
Attribute is an optional parameter. This is where you specify the type of information you need about the selected stock. If you leave it blank, it will return the price by default. As this is a string, you need to enclose the value in quotes.
Supported attributes include
price – The current market price (CMP) of the stock