| | |
Execute PHP file in the background from html page
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2009
Posts: 9
Reputation:
Solved Threads: 0
Thank you ardav and robert_c_guy, I'll check what you suggest as soon as possible.
Is it possible by the way that the output of the php file gets stored in an external log file? (Either by appending new info about warnings, errors, normal output etc, or by replacing each time the existing log file with the new output? You see, this might be helpful sometimes.)
Thanks.
Is it possible by the way that the output of the php file gets stored in an external log file? (Either by appending new info about warnings, errors, normal output etc, or by replacing each time the existing log file with the new output? You see, this might be helpful sometimes.)
Thanks.
php Syntax (Toggle Plain Text)
$output = bla blah bla; /* the data output from the background php page. I had to put SOMETHING here, */ $getdate = date( 'd-m-Y, H:i:s' );// Get the date. $user_ip = $_SERVER['REMOTE_ADDR'];// Get the user IP, just in case. $referer = getenv("HTTP_REFERER");// Get the refering page. just in case $file = "./your path to logfile/logfile.csv"; /*define the file as required, csv opens easily in excell or imports to sql if REQ, but is really just a text file.*/ $fp = fopen($file, "a+"); //open the text file for writing. // Write into the text file. fputs ($fp, "$getdate, $user_ip, $referer, $output\n"); //see note after $output definition above fclose($fp);// Close the text file.
$output Last edited by almostbob; Jan 9th, 2009 at 11:15 pm.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
•
•
Join Date: Jul 2008
Posts: 148
Reputation:
Solved Threads: 25
Seems i am a bit late to the game, but your problem definitely lends itself to using AJAX.
and it would be a rather simple solution at that.
Although instead of recommending you learn AJAX from scratch, I'm going to point you to the prototype library http://www.prototypejs.org/ I'm sure you've probably heard of it.
Now,as far as working with prototype, I think the most all encompassing tutorial I have ever seen has to be this one http://www.phpriot.com/series/8-weeks-of-prototype
If you browse through those 8 lessons you'll have a pretty sound understanding of how it all works and comes together.
and it would be a rather simple solution at that.
Although instead of recommending you learn AJAX from scratch, I'm going to point you to the prototype library http://www.prototypejs.org/ I'm sure you've probably heard of it.
Now,as far as working with prototype, I think the most all encompassing tutorial I have ever seen has to be this one http://www.phpriot.com/series/8-weeks-of-prototype
If you browse through those 8 lessons you'll have a pretty sound understanding of how it all works and comes together.
![]() |
Similar Threads
- dynamic html (PHP)
- Creating an event or an action to a button. (PHP)
- problem in javascript coding in asp page (ASP)
- php adodb library connect remote mysql (PHP)
Other Threads in the PHP Forum
- Previous Thread: Getting the contents of a DIV on another page
- Next Thread: google chekout help
| Thread Tools | Search this Thread |
Tag cloud for PHP
# .htaccess 5.2.10 access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display dissertation download dynamic echo echo$_get[x]changingitintovariable... email error file files folder form forms function functions google href htaccess html image images include insert integration ip java javascript joomla ldap legislation limit link local login loop mail menu mlm mod_rewrite multiple mysql mysqlquery oop open paypal pdf persist php problem query radio random recursion regex remote script search server sessions sms soap sockets source space sql syntax system table tutorial update upload url validation validator variable video web xml youtube






