0
I tried a lot of ways to do something like "php file reads the URL file, write another same one inside ftp"
Code tested 1:
<!-- language: lang-php -->
<?php
if(empty( $_POST['q']))
exit('Use o parametro q');
$url = 'https://www.youtube.com/watch?v=' . $_POST['q'];
$ch = curl_init();
$Variaveis = array(
'format' => 'json',
'video' => $url
);
$url = 'http://youtubeinmp3.com/fetch/?' . http_build_query($Variaveis);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
curl_close($ch);
$dados = json_decode($response, true);
$src = fopen($dados['link'], 'r');
$dest = fopen($_POST['f'] . '.mp3', 'w');
stream_copy_to_stream($src, $dest);
?>
In FTP it copies files with extension . txt . png (Direct files), when it is the URL I need, it creates the file, but does not write, and gets 0kbs.
Now when testo on localhost here at home works normal.
Add the code and then press
{ }
formatting.– user28595