• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Curl

#1
[eluser]Unknown[/eluser]
hello
i want to get video from URL and save it in folder
this is the sample of URL

url="http://vod.cms.download.performgroup.com/omnisport/ready/french/162/fr-050612-ireland_1338883384151_162.m4v"

how i can do that

please if anyone can help me
thanks for all




#2
[eluser]Cristian Gilè[/eluser]
Add the following method to your controller (or library or helper):

Code:
function get_video_from_url($link)
{  
    $ch = curl_init();  
    curl_setopt($ch, CURLOPT_POST, 0);
    curl_setopt($ch,CURLOPT_URL,$link);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $result=curl_exec($ch);
    curl_close($ch);
    return $result;
}

call the new method and save the file locally:

Code:
$video = $this->get_video_from_url("http://vod.cms.download.performgroup.com/omnisport/ready/french/162/fr-050612-ireland_1338883384151_162.m4v");

if ( ! write_file('./video.m4v', $video))
{
    echo 'Unable to write the file';
}
else
{
    echo 'File written!';
}

#3
[eluser]Sanjay Sarvaiya[/eluser]

Code:
copy ( $source , $dest);
further more information read http://www.php.net/copy/

#4
[eluser]Unknown[/eluser]
thanks all

i try Cristian Gilè code and it's work Smile thanks


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.