I am trying to put this cURL command in PHP, but it doesn´t seem to work yet.
I want to post a SRT file to https://atelier.u-sub.net/srt2vtt/index.php because that website converts the SRT to a VVT file. I want to save the output of the website (the VVT file) to a file on my server. When I run the cURL command on my Linux server, it outputs the VVT file (so that works).
Command:
curl --form "subrip_file=@Stranger.Things.S01E08.720p.WEBRip.x264-SKGTV.srt" https://atelier.u-sub.net/srt2vtt/index.php
My PHP code:
$request = curl_init('https://atelier.u-sub.net/srt2vtt/index.php');
// send a file
curl_setopt($request, CURLOPT_POST, true);
curl_setopt(
$request,
CURLOPT_POSTFIELDS,
array(
'subrip_file' => '@' . realpath('Stranger.Things.S01E08.720p.WEBRip.x264-SKGTV.srt')
));
// output the response
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($request);
// close the session
curl_close($request);