Forum Moderators: coopster

Message Too Old, No Replies

Working of PHP explaination

Info on how PHP works.

         

redskins80

6:05 pm on Jul 9, 2011 (gmt 0)

10+ Year Member



Hi a noob here..

I wanted to make web pages in which a php script would run n fetch contents from other sites using fopen. Now while it does that, i wish to show some kind of text or image. What i dont understand is, does PHP take the entire .php file, find out where ALL the <?php tags are and return an html? which is then processed as a whole? or it goes sequentially and as and when php tags are encountered requests are sent to the server which then sends output back?

penders

9:48 am on Jul 10, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



PHP is processed entirely on the server. So, all the <?php ... ?> sections within the page are processed and the resulting static HTML is returned to the client/browser in one go. Finished.

To do what you require... show progress whilst external pages are fetched using PHP you need to combine this with JavaScript (the XMLHttpRequest object aka "AJAX").

The (static) HTML page, with placeholder images, is sent to the client. Using JavaScript issue XMLHttpRequests to your server-side PHP script for each block of external content. Wait for the response. Once received, insert this into the page using JavaScript.

redskins80

4:40 pm on Jul 11, 2011 (gmt 0)

10+ Year Member



aaah a mixture of server and client side! makes sense. thanks penders.. ill havta study AJAX properly now.