Jump to content

cURL?


The Little Guy

Recommended Posts

I made some CURL, and it works fine... I grab a video form the web, and transfer it to my server with this:

<?php
$fileName = getdir ($URL);
$fileExt = getext ($URL);
$ch = curl_init ($URL);
$fp = fopen ("../../tzfiles.com/users/$dir/$fileName", "w");
curl_setopt ($ch, CURLOPT_FILE, $fp);
curl_setopt ($ch, CURLOPT_HEADER, TRUE);
curl_exec ($ch);
curl_close ($ch);
fclose ($fp);
?>

 

But, for some reason this isn't working, it is supposed to convert the downloaded file, and convert it to a flv file. I am not sure if it is working right or just renaming the file to flv, and making the file size 0.

 

Here is the code:

<?php
if(in_array($fileExt,$video_types)){
if($fileExt!='.flv'){
	//320x240                   -ar 22050 -ab 32 -f flv
	exec ("/usr/bin/ffmpeg -i '../../tzfiles.com/users/$dir/$fileName' -sameq -qmax 100 -s 320x240 -aspect 4:3 '../../tzfiles.com/users/$dir/$flvName'");
}
if(!file_exists("../../tzfiles.com/users/$dir/thumbs/videos")){
	mkdir ("../../tzfiles.com/users/$dir/thumbs/videos");
}
exec ("ffmpeg -i '../../tzfiles.com/users/$dir/$flvName' -an -ss 00:00:03 -t 00:00:01 -r 1 -y -s 120x90 '../../tzfiles.com/users/$dir/thumbs/videos/$f%d.jpg'");
	rename ("../../tzfiles.com/users/$dir/thumbs/videos/".$f."1.jpg","../../tzfiles.com/users/$dir/thumbs/videos/$f.jpg");
unlink ("../../tzfiles.com/users/$dir/$fileName");
$fileName = $flvName;
$fileExt = '.flv';
}
?>

Link to comment
https://forums.phpfreaks.com/topic/92269-curl/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.