I am writing a parser to get a video. But I can’t save the resulting video to the folder I need. How to fix here code.
foreach ($href as $key => $link) { $doc = file_get_html('https://example.com/'.$link); foreach($doc->find("#video source") as $el) { $video[]="https:".$el->src; //с помощью simple html dom получаю ссылки на файл } } //в итоге получаю /* array( "http:example/video1.mp4", "http:example/video2.mp4", "http:example/video3.mp4") */ $dirSubtitles=$_SERVER['DOCUMENT_ROOT'].'/video/'; foreach ($video as $address) { $url = $address; $path = $dirSubtitles; $fp = fopen($path."video", 'w'); $ch = curl_init($url); curl_setopt($ch, CURLOPT_FILE, $fp); $data = curl_exec($ch); curl_close($ch); fclose($fp); }