Results 11 to 20 of 21
-
18th Jan 2012, 01:43 PM #11MemberWebsite's:
wautoposter.comcurl progress info example php function
you can use this progress function in any curl php script just add
if $ch = curl_init($link);
add this line after $ch = curl_init($link);
example 1
PHP Code:$ch = curl_init($link);
addProgressInfo($ch);
example 2
PHP Code:$c = curl_init();
addProgressInfo($c);
Full function with example
PHP Code:function Host($link, $postfields = '', $cookie = '') {
$ch = curl_init($link);
addProgressInfo($ch);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER, 'http://www.filehosts.com/');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
if ($postfields) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
}
if ($cookie) {
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
}
$page = curl_exec($ch);
return($page);
curl_close($ch);
}
function progress_info($dltotal,$dlnow,$ultotal,$ulnow){
@passthru('clear');
if($ultotal>0){
echo sprintf(" Upload: %.2f%% of %.2f MB\n"
,($ulnow/$ultotal)*100
,$ultotal/(1024*1024)
);
}
if($dltotal>0){
echo sprintf(" Download: %.2f%% of %.2f MB\n"
,($dlnow/$dltotal)*100
,$dltotal/(1024*1024)
);
}
return(0);
}
function addProgressInfo($ch){
curl_setopt($ch, CURLOPT_NOPROGRESS, false);
curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, 'progress_info');
}
-
19th Jan 2012, 06:23 AM #12OPMemberWebsite's:
WarezRocker.info Share4U.org Imdb.WarezRocker.info DownTurko.org Host-Palace.com HeroTurko.proi am using this code for save a file,how to add progressbar in it? i tried with adding your progressbar code but its not working.
PHP Code:function curldlfile($link, $saveto)
{
$handle = fopen($saveto, 'w');
if ($handle)
{
$ch = curl_init( $link);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_FILE, $handle);
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 />Change DownLoad To Folder to 777?";
exit();
}
}
-
19th Jan 2012, 07:04 AM #13MemberWebsite's:
wautoposter.comi have add progress bar in your filesonic function
SCREENSHOT
PHP Code:<?php
$filespath = "/folder/";
$link = "http://www.filesonic.com/file/WbJclvs";
$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 = "fsemail"; //
$pass = "fspassword"; //
$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 = "fsemail"; //
$pass = "fspassword"; //
$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();
addProgressInfo($ch);
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();
}
}
function progress_info($dltotal,$dlnow,$ultotal,$ulnow){
@passthru('clear');
if($ultotal>0){
echo sprintf(" Upload: %.2f%% of %.2f MB\n"
,($ulnow/$ultotal)*100
,$ultotal/(1024*1024)
);
}
if($dltotal>0){
echo sprintf(" Download: %.2f%% of %.2f MB\n"
,($dlnow/$dltotal)*100
,$dltotal/(1024*1024)
);
}
return(0);
}
function addProgressInfo($ch){
curl_setopt($ch, CURLOPT_NOPROGRESS, false);
curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, 'progress_info');
}
?>
-
19th Jan 2012, 07:21 AM #14OPMemberWebsite's:
WarezRocker.info Share4U.org Imdb.WarezRocker.info DownTurko.org Host-Palace.com HeroTurko.proi dont know why but in my server its not working,
http://releasedw.ws/autobot/fso.php
check it,is there any requirement? like php 5.3 blah blah...
-
19th Jan 2012, 08:10 AM #15OPMemberWebsite's:
WarezRocker.info Share4U.org Imdb.WarezRocker.info DownTurko.org Host-Palace.com HeroTurko.pro
-
19th Jan 2012, 01:20 PM #16MemberWebsite's:
sborg.usYou might wanna change the name of the "autobot" directory now
V3g3ta | Halcyon | Abhi
-
19th Jan 2012, 03:25 PM #17OPMemberWebsite's:
WarezRocker.info Share4U.org Imdb.WarezRocker.info DownTurko.org Host-Palace.com HeroTurko.pro
-
20th Jan 2012, 06:28 AM #18OPMemberWebsite's:
WarezRocker.info Share4U.org Imdb.WarezRocker.info DownTurko.org Host-Palace.com HeroTurko.pro
-
20th Jan 2012, 07:34 AM #19MemberWebsite's:
imdber.org justpaste.meHave the line be continuously changed through ajax
-
20th Jan 2012, 07:51 AM #20MemberWebsite's:
wautoposter.com
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 2 users browsing this thread. (0 members and 2 guests)
Similar Threads
-
Curl to Uploaded.to
By skinner in forum Web Development AreaReplies: 18Last Post: 12th Feb 2012, 07:05 AM -
Curl url file (I need help)
By spanero in forum Web Development AreaReplies: 3Last Post: 22nd Dec 2011, 04:23 PM -
Curl IPB help
By xwarlordx in forum Web Development AreaReplies: 3Last Post: 23rd Aug 2011, 06:33 AM -
cURL Pro Coders.
By kohkindachi in forum Completed TransactionsReplies: 2Last Post: 5th Dec 2010, 12:30 AM -
How to install CURL in WHM
By ken in forum Technical Help Desk SupportReplies: 2Last Post: 22nd Sep 2010, 01:46 PM
themaCreator - create posts from...
Version 3.57 released. Open older version (or...