-----Original Message-----
From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]]On Behalf Of Christopher Taylor
Sent: 18 October 2005 15:00
To: [email protected]
Subject: Re: [newbie] php to html or pdfSorry abouty that. You can use an fprintf to write to a file. Just write the output of the script to a file as welll as to the screen. The script can email the file as an attachment. The script can alo do the ftp.
--
Christopher Taylor - Registered Linux User #383327lol, don't apologise Chris, not sure that will work looking at the man page. I'll tell you what I have got so far as that might help. I run a few scripts to collect info from a server, this creates some graphs as png's that are used in some php pages that I publish on my internal web site. It is only internal as my company are funny with internal and external connections. What I want to do is add a bit to the end of the script so that I can create a file, that I will then ftp to a server that will publish the html/pdf for external customers and also send an email to a few people.Thanks,Tony.
It is an intersting project. I have done some work having the php script write out an htmll file. In this case, there was a database table and I had a script that dumped the data to an html file with a table (no images). I have also done a number of scripts that involve emailing. I haven't tried the ftp yet. I think that is probably the biggest hurdle. The other two are pretty straight forward. Here is a code snippet that I took from the php site, I think you would need separate puts for each html and png file:
<?php
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id,
$ftp_user_name, $ftp_user_pass);
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user $ftp_user_name";
exit;
} else {
echo "Connected to $ftp_server, for user $ftp_user_name";
}
// upload the file
$upload = ftp_put($conn_id,
$destination_file, $source_file, FTP_BINARY);
// check upload status
if (!$upload) {
echo "FTP upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as $destination_file";
}
// close the FTP stream
ftp_close($conn_id);
?>
--
Christopher Taylor - Registered Linux User #383327
