Downloading mp4 file for stream with selenium WebDriver on PHP

I using PHP selenium webdriver for automation.
In remote server we have mp4 file that on click play it stream video to the browser.

How can i catch the video and save to file?


use FacebookWebdriver;
use FacebookWebDriverWebDriverBy;
use FacebookWebDriverChromeChromeOptions;
use FacebookWebDriverRemoteDesiredCapabilities;
use FacebookWebDriverChromeChromeDriver;
use FacebookWebDriverExceptionWebDriverException;
use FacebookWebDriverRemoteRemoteWebDriver;
use FacebookWebDriverRemoteRemoteWebElement;
use FacebookWebDriverWebDriverExpectedCondition;
use FacebookWebDriverWebdriverpoint;

require_once __DIR__ . '/vendor/autoload.php';

$host="http://localhost:4444/wd/hub";
$driver->get("http://example.com");

$vid = $driver->findElement(WebDriverBy::xpath('videojs_html5'))->getAttribute("src");

//here need to save source to file

I have tried with fopen and file_get_contents, both not able to get the mp4 stream file.

Read more here: Source link