Reputation: 35
Here's what I have for example:
ServerA : http://192.168.12.12/cctv/monitor1 (This shows a CCTV video stream of monitor 1)
ServerB : http://192.168.13.13/monitoring (This is my webpage which i want to show the video stream from ServerA) *ps : this also can ping/access to ServerA
PC1 : PC that have permission ping/access to both ServerA and ServerB
PC2 : PC that have NO PERMISSION to ping/access to ServerA, but can access to ServerB (My web)
///////
It works fine if I just show the streaming from client-side cuz PC1 got full permission to access ServerA.
But theres the problem when it come to use PC2 to access my webpage, it wont show the video of ServerA.
I've tried to use cURL and it ended up a super long loading (more like infinite load), still i don't know if it was possible to fetch a video from cURL or not.
The GOAL im trying to reach is to make my web as a middleware for ServerA and PC2
PC2 > my web (ServerB) > the videos (ServerA)
///---------------------------------------------------------------------------------------------------
Here's my explanation of my codes for example :
/* Loop url of the stream videos*/
for($i=0;$i<count($cctv);$i++){
echo "<iframe src='".$cctv['link']."'/>"
}
/* Function of cURL (honestly i use this function for each of the cctv link i've looped like checkcURL($cctv['link']) ) */
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST ,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,0);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
//-----------------------------------------------------------------------------
Sorry if both of my explanation either my english was bad, hope you guys have a good day
Upvotes: 1
Views: 550
Reputation: 45
just want to add, don't forget to always put maximum timeout (i.e. 60s, can be vary according to your usecase) on your any production grade projects when doing curl or http request. That way, your services are not by any means dependent or at other's services mercy. Even if the remotes / external services hung up, your services won't.
Have a nice day :)
Upvotes: 1