Activity Stream
48,167 MEMBERS
61769 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1.     
    #1
    Member
    Website's:
    wautoposter.com
    curl 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); 
    OR if $c = curl_init();

    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($chCURLOPT_RETURNTRANSFER1);
                
    curl_setopt($chCURLOPT_HEADER1);
                
    curl_setopt($chCURLOPT_FOLLOWLOCATION1);
                
    curl_setopt($chCURLOPT_REFERER'http://www.filehosts.com/');
                
    curl_setopt($chCURLOPT_HTTPHEADER, array('Expect:'));
                if (
    $postfields) {
                    
    curl_setopt($chCURLOPT_POST1);
                    
    curl_setopt($chCURLOPT_POSTFIELDS$postfields);
                }
                if (
    $cookie) {
                    
    curl_setopt($chCURLOPT_COOKIE$cookie); 
                    
    curl_setopt($chCURLOPT_COOKIEJAR$cookie);
                    
    curl_setopt($chCURLOPT_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($chCURLOPT_NOPROGRESSfalse);
                
    curl_setopt($chCURLOPT_PROGRESSFUNCTION'progress_info');
            } 
    jpavsex Reviewed by jpavsex on . Need Help In cURL Progressbar i need a progress bar for my downloader script,my script is curl based and its saving files using cul file function,and i don't have knowledge about progressbar,guys please help me.i need it urgent. What I Need? Ans: every 5 sec it will update the status of trasfer,like how much downloaded in 5 sec/total size and then status of 10 sec count......or in % Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    Website's:
    WarezRocker.info Share4U.org Imdb.WarezRocker.info DownTurko.org Host-Palace.com HeroTurko.pro
    i 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($chCURLOPT_HEADER1); 
            
    curl_setopt($chCURLOPT_FOLLOWLOCATION1);
            
    curl_setopt($chCURLOPT_FILE$handle);
         
    curl_setopt($chCURLOPT_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();
        }


  4.     
    #3
    Member
    Website's:
    wautoposter.com
    i 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($chCURLOPT_URL$link); 
            
    curl_setopt($chCURLOPT_FILE$handle); 
            
    curl_setopt($chCURLOPT_FOLLOWLOCATION1); 
         
    curl_setopt($chCURLOPT_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($chCURLOPT_NOPROGRESSfalse);
                
    curl_setopt($chCURLOPT_PROGRESSFUNCTION'progress_info');
            }  
    ?>

  5.     
    #4
    Member
    Website's:
    WarezRocker.info Share4U.org Imdb.WarezRocker.info DownTurko.org Host-Palace.com HeroTurko.pro
    i 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...

  6.     
    #5
    Member
    Website's:
    WarezRocker.info Share4U.org Imdb.WarezRocker.info DownTurko.org Host-Palace.com HeroTurko.pro
    its working now,its required php 5.3 minimum for working progressbar.thanks a lot.

  7.     
    #6
    Member
    Website's:
    sborg.us
    You might wanna change the name of the "autobot" directory now

    V3g3ta | Halcyon | Abhi

  8.     
    #7
    Member
    Website's:
    WarezRocker.info Share4U.org Imdb.WarezRocker.info DownTurko.org Host-Palace.com HeroTurko.pro
    Quote Originally Posted by Halcyon View Post
    You might wanna change the name of the "autobot" directory now
    thx.

  9.     
    #8
    Member
    Website's:
    WarezRocker.info Share4U.org Imdb.WarezRocker.info DownTurko.org Host-Palace.com HeroTurko.pro
    getting a problem,its not updating in one line,can help plz?



  10.     
    #9
    Member
    Website's:
    imdber.org justpaste.me
    Have the line be continuously changed through ajax

  11.     
    #10
    Member
    Website's:
    wautoposter.com
    use ajax

Page 2 of 3 FirstFirst 123 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Curl to Uploaded.to
    By skinner in forum Web Development Area
    Replies: 18
    Last Post: 12th Feb 2012, 07:05 AM
  2. Curl url file (I need help)
    By spanero in forum Web Development Area
    Replies: 3
    Last Post: 22nd Dec 2011, 04:23 PM
  3. Curl IPB help
    By xwarlordx in forum Web Development Area
    Replies: 3
    Last Post: 23rd Aug 2011, 06:33 AM
  4. cURL Pro Coders.
    By kohkindachi in forum Completed Transactions
    Replies: 2
    Last Post: 5th Dec 2010, 12:30 AM
  5. How to install CURL in WHM
    By ken in forum Technical Help Desk Support
    Replies: 2
    Last Post: 22nd Sep 2010, 01:46 PM

Tags for this Thread

BE SOCIAL