Location: PHPKode > scripts > WGetAgent > wgetagent/example.php
<?
    // copy finish_download script in /tmp dir and make sure it has execution rights on it (chmod 775)
    include( "wget.inc.php" );

    $wget_sess = new wget_agent( "http://www.google.com", "/tmp" );

    $cls = new someClass();
    
    $wget_sess->wget_store_function( "someMethod", "cls" );
    
    $wget_sess->wget_script( "/tmp/finish_download" );

    $error = $wget_sess->get_error();
    if( !$error["error_no"] )
    {
        echo "Starting download...<br>\n";
        $wget_sess->wget_run();
        echo "<br>\n".
             "After download completes check /tmp dir...<br>\n";
    } else
        echo $error["error_msg"];



function bubu( $a1, $a2, $a3 )
{
    echo "Session: [$a1]<br>\n".
         "URL: [$a2]<br>\n".
         "Destination: [$a3]<br>\n";
    // insert download info into a table maybe...
}

class someClass
{

 function someMethod( $a1, $a2, $a3 )
 {
    echo "Session: [$a1]<br>\n".
         "URL: [$a2]<br>\n".
         "Destination: [$a3]<br>\n";
    // insert download info into a table maybe...
 }

}
?>
Return current item: WGetAgent