just made it becoz someone me pm about it....
For php uploader:
PHP:
<?php
$filespath = dirname(__FILE__)."/files/";
$link = "http://www.filesonic.com/file/JHMyF1L";
$filename = getfsofilename($link);
$link = getfsolink($link);
$saveto = $filespath . $filename;
echo "<b>Downloading</b> ..........</br><b>Filename:</b> $filename</br><b>Link:</b> $link ....<br />";
curldlfile($link, $saveto);
function getfsofilename($link)
{
$user = "fsc user"; //
$pass = "fsc pass"; //
$page = $link;
$id = explode("/", $page);
$id = trim($id[4]);
$apicall = "http://api.filesonic.com/link?method=getDownloadLink&u=$user&p=$pass&ids=$id";
$page = file_get_contents($apicall);
preg_match('#\"filename\":\"(.*)\",\"url\"#', $page, $match1);
$filename = $match1[1];
return $filename;
}
function getfsolink($link)
{
$user = "fsc user"; //
$pass = "fsc pass"; //
$page = $link;
$id = explode("/", $page);
$id = trim($id[4]);
$apicall = "http://api.filesonic.com/link?method=getDownloadLink&u=$user&p=$pass&ids=$id";
$page = file_get_contents($apicall);
preg_match('#\"url\":\"(.*)\"}}},#', $page, $match);
$linksid = $match[1];
$link = str_replace("\/","/",$linksid);
return $link;
}
function curldlfile($link, $saveto)
{
$handle = fopen($saveto, 'w');
if ($handle)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $link);
curl_setopt($ch, CURLOPT_FILE, $handle);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1');
curl_exec($ch);
curl_close($ch);
fclose($handle);
}
else
{
echo "<br />Could not download $link. Is your 'files' folder chmodded to 777?";
exit();
}
}
?>
For php uploader:
curl downloa function:
PHP:
function curldlfile($link, $saveto)
{
$handle = fopen($saveto, 'w');
if ($handle)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $link);
curl_setopt($ch, CURLOPT_FILE, $handle);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1');
curl_exec($ch);
curl_close($ch);
fclose($handle);
}
else
{
echo "<br />Could not download $link. Is your 'files' folder chmodded to 777?";
exit();
}
}
Get Filename:
PHP:
function getfsofilename($link)
{
$user = "fsc username";
$pass = "fsc password";
$page = $link;
$id = explode("/", $page);
$id = trim($id[4]);
$apicall = "http://api.filesonic.com/link?method=getDownloadLink&u=$user&p=$pass&ids=$id";
$page = file_get_contents($apicall);
preg_match('#\"filename\":\"(.*)\",\"url\"#', $page, $match1);
$filename = $match1[1];
return $filename;
}
Get Filelink:
PHP:
function getfsolink($link)
{
$user = "fsc username";
$pass = "fsc password";
$page = $link;
$id = explode("/", $page);
$id = trim($id[4]);
$apicall = "http://api.filesonic.com/link?method=getDownloadLink&u=$user&p=$pass&ids=$id";
$page = file_get_contents($apicall);
preg_match('#\"url\":\"(.*)\"}}},#', $page, $match);
$linksid = $match[1];
$link = str_replace("\/","/",$linksid);
return $link;
}
PHP:
$filename = getfsofilename($link);
$link = getfsolink($link);
$saveto = $filespath . $filename;
echo "<b>Downloading</b> ..........</br><b>Filename:</b> $filename</br><b>Link:</b> $link ....<br />";
curldlfile($link, $saveto);
Last edited: