Run PHP file in Laravel Controller

38 Views Asked by At

I need some hints for running the below code in Laravel,

Below is the vendor code, which I have installed with composer, and if I run php ..pathto/./websocket_client.php it prints the output in the terminal.

https://github.com/upstox/upstox-php/tree/master/examples/websocket/market_data https://github.com/upstox/upstox-php/blob/master/examples/websocket/market_data/websocket_client.php

But my question is how can I run this php script in Laravel controller, I mean when I open the route this websocket_client.php script should run and I get data in JSON format to render in view.

Also in this code, how can we send value to instrument_key

    // Message payload to send to the server
    $data = [
        "guid" => "someguid",
        "method" => "sub",
        "data" => [
            "mode" => "full",
            "instrumentKeys" => ["NSE_FO|53983"]
        ]
    ];

0

There are 0 best solutions below