Hi All,

I have made an internal system for my work colleagues to store their quotes for customers. They enter the name, item, price, discount etc.

To send this to a customer they either have to print it and fax (fine) or email it some how.
What I am thinking is to convert the php file to html and email that.

I have a conversion script

function buildhtml($strphpfile, $strhtmlfile) {

echo "Building ".$strhtmlfile."<br>";
// start buffering the output
ob_start();
include($strphpfile);

// write to a file
$data = ob_get_contents();
$fp = fopen ($strhtmlfile, "w");
fwrite($fp, $data);
fclose($fp);
ob_end_clean();
}
// make calls to the buildhtml function here, giving input and output filenames
buildhtml("quote.php","quote.htm"); 

which works fine for
quote.php
but wont accept
quote.php?id=12
etc (which is how my site works

Any help or suggestions would be greatly appreciated

Thanks

Al

    Include doesnt work that way. You cant give it variables like that. You can use file_get_contents with whole url to achieve that(and more easily):

    function buildhtml($src, $dst) {
        echo "Building ".$src."<br>";
    
    // write to a file
    $data = file_get_contents('http://somedomain.com/'.$src);
    $fp = fopen ($dst, "w");
    fwrite($fp, $data);
    fclose($fp);
    }
    
    buildhtml('quote.php?id=5','quote5.html');
    

    Like that for example. Customize that to your needs.

      Write a Reply...