#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    64
    Rep Power
    12

    Help converting a php script to C++


    I basically know what to do, but im stumped on the split and the array's. Thanks

    PHP Code:
    #!/usr/local/apache/php/bin/php -q

    <?php
    // Bandwidth Parser //
    // Takes the Webalizer file and strips it down to leave the bandwidth in kb. //

    $user $argv[1];

    $f fopen("/home/$user/public_html/webalizer/index.html""r");
    $file fread ($ffilesize ("/home/$user/public_html/webalizer/index.html"));

    $split_file preg_split("/[\n,]+/""$file");

    $bandwidth $split_file[53];


    $trans array_flip(get_html_translation_table(HTML_ENTITIES));
    //strip nonbreaking space, strip php tags, strip html tags, convert html entites, strip extra white space
    $search_clean = array("%&nbsp;%i""%<\?.*\?>%Usi""%<[\/]*[^<>]*>%Usi""%(\&[a-zA-Z0-9\#]+;)%es""%\s+%");
    $replace_clean = array(" """"""strtr('\\1',\$trans)"" ");
    $bandwidth2 preg_replace($search_clean$replace_clean$bandwidth);

    // Calculate to human //

    $bandwidth2 $bandwidth2 1024;

    echo 
    "$bandwidth2\n";
    ?>
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Representin' Quebec
    Posts
    106
    Rep Power
    12
    I know a bit of php, but not enough to do the whole thing maybe. But I'll be able for sure if you put up some pseudo-code! (please)
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    No es importante
    Posts
    2,065
    Rep Power
    14
    What section of the code are you needing assistance with? Arrays? Files?

IMN logo majestic logo threadwatch logo seochat tools logo