Jump to content

SQL > PHP > HTML?


layton

Recommended Posts

Judging by the topic description you're probably thinking "well yeah!!" but here's the deal.At my place of employment, for whatever reason, the IT department has decided to not support any dynamic content or database services. I CAN, however, setup a localhost sql server and get php going on my machine as well. What i'm looking to do is make a glorified status page on jobs that i have to do. The idea is to use php / sql to input jobs and their status via form....and later change that information based on completion. The downside is that for my boss to see this data it needs to be on our test or live servers that don't support sql / php. So the question is. Is there a way to pull the data with php from my localhost and convert it an html file.

Link to comment
Share on other sites

Yes there is. It is call screen scrapping. In short you would set up a php page that allows you insert a filename (yourname.html) and what the source url is (localhost/yourdynamicpage.php). The screen scrapping code would then pull the generated html from your source page. then you can use this info to generate an html page.http://www.google.ca/search?hl=en&sa=X...ing&spell=1

Link to comment
Share on other sites

Yes there is. It is call screen scrapping. In short you would set up a php page that allows you insert a filename (yourname.html) and what the source url is (localhost/yourdynamicpage.php). The screen scrapping code would then pull the generated html from your source page. then you can use this info to generate an html page.http://www.google.ca/search?hl=en&sa=X...ing&spell=1
do you have experience with this? i downloaded a screen scrape script...which does grab the html code. so now how to i tell the script to save that information into an html document?
Link to comment
Share on other sites

$fnew = fopen("yourfilename.html", "w+");flock($fnew, 1);then you can open your new file and write to it.
that makes sense....except to my knowledge the script im using doesn't create a file to open...i'm usinghttp://www.tgreer.com/class_http_php.htmlwhat i do is supply a url. it scrapes it and echo's back the contents. now i see that all i need to do is take the data and instead of echo back just put it into a new document.htmlunless your saying i should create the document.html manually and then fopen it?EDIT: ok i see that fopen will create the file if it doesn't exist. so pretty much i fopen, fwrite....thanks alot!!
Link to comment
Share on other sites

nope don't create it manually. Instead of echoing the results store it in a variable.Then create the new file with the code I showed you for that. then using fopen() again (see PHP Manual at php.net) open the file and write the variable holding hte results.All done :)

Link to comment
Share on other sites

nope don't create it manually. Instead of echoing the results store it in a variable.Then create the new file with the code I showed you for that. then using fopen() again (see PHP Manual at php.net) open the file and write the variable holding hte results.All done :)
yep....saw that and wrote the edit on my post.....must have wrote the edit as you were responding. got it all taken care of now.....pretty sweet. Thanks a lot sir.
Link to comment
Share on other sites

That's true. Here is a complete script to read a to, subject, and message from POST and send an email, and also write out the entire contents of the POST array to a file for debugging:

<?phpob_start();print_r($_POST);$output = ob_get_contents();ob_end_flush();file_put_contents("postdata.txt", $output);mail($_POST['address'], $_POST['subject'], $_POST['body']);?>

Link to comment
Share on other sites

To do what? The filename is given in the quotes, if you want to copy the contents of a file to another file, I guess the $output variable could be a file_get_contents call.
duh! sorry :) I must have smoked too much crack today
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...