10-01-2009, 10:50 AM
|
#1 (permalink)
|
|
The Contributor
Join Date: Jul 2009
Posts: 80
Thanks: 13
|
cURL - m4v
Hi i am using the following code to transfer files that start with m4v, however they are not copying over. i was wondering if cURL is able to copy these files?
PHP Code:
<?php
/**
* Initialize the cURL session
*/
$ch = curl_init();
/**
* Set the URL of the page or file to download.
*/
$filename = 'http://example.com/file.m4v';
$finfo = explode('.',$filename);
$fileSuffix = array_pop($finfo);
curl_setopt($ch, CURLOPT_URL, $filename);
/**
* Create a new file
*/
$fp = fopen('r.'.$fileSuffix, 'w');
/**
* Ask cURL to write the contents to a file
*/
curl_setopt($ch, CURLOPT_FILE, $fp);
/**
* Execute the cURL session
*/
curl_exec ($ch);
/**
* Close cURL session and file
*/
curl_close ($ch);
fclose($fp);
print '<a href="r.'.$fileSuffix.'"/>';
?>
|
|
|
|