i am using CURL to get data from server. The way it works is like the following:
- A device send data to routing application which is found on server.
- To get the data from the routing application, clients must ask with GET method specifying server address, port and parameter.
- once a client is connected, the application start sending data on every new packet arrived from the device to connected clients. see below picture
now lets see my code that i run to get the response:
<?php $curl = curl_init('http://192.168.1.4/online?user=dneb'); curl_setopt($curl, CURLOPT_PORT, 1818); curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); $result = curl_exec($curl); curl_close($curl); echo $result;
With this CURL request i can get the response data from routing application. But the routing application will never stop sending data to connected clients, so i will get the result only if i close the routing application, and it will echo every data as one. Now my question is how can i echo each data without closing the connection or the connection closed by the routing application? i.e When data received, display the data without any conditions. You can suggest any other options to forward this data to another server using TCP. Thanks!