Skip to content
Advertisement

Get data from URL using PHP

enter image description here This is incoming call API URL. so, this URL wont stop loading. this URL keep loading and give data in json format. how to get data from this kind of URL using PHP.

        $ch = curl_init();

        curl_setopt_array($ch,[
            CURLOPT_RETURNTRANSFER => 1,
            CURLOPT_URL => 'https://konnectprodstream3.knowlarity.com:8200/update-stream/api-key/konnect'
        ]);

        // grab URL and pass it to the browser
        $response = curl_exec($ch);

        echo $response;

        curl_close($ch);

Advertisement

Answer

Why you used the php CURL to http request.

You can use the laravel HTTP client.

You can see: https://laravel.com/docs/8.x/http-client#making-requests

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement