0

Working with files compiler that puts a bit of a strain on FIRST homepage hit until the css files are compiled thus fooling the visitor that site is slow,

I have successfully routed the function to ajax witch works very well but I cant let it go since it is bound to js and would love to do this with php

the ajax mootools

new Request({
url: linktofile... and basic responses 

does nothing else but is accessing php file which says

// sitename.com/?view=custom
file_get_contents('OF_THE_website_but_different_view');

so how would I do this from php was trying exec() , cant get to work (WAMP local) CURL , would be same as if I would do file_get_contents() within homepage and slows everything down again was trying to see how proc_open() works but I cant figure it out

so if anyone could rout me to use any php function as a fallback for ajax and call my file_get_contents() file in backend without slowing the homepage down.

please do not suggest SHELL , CRON , or any other lang but PHP

Thank you!

Benn
  • 4,840
  • 8
  • 65
  • 106
  • The ideal way of doing this is using a cron job that runs frequently, and independently from what the user is doing. Anything else is likely to hit some restriction if you are on shared hosting. – Pekka Oct 19 '12 at 19:39
  • thus I say no shell , and should also say no CRON – Benn Oct 19 '12 at 19:42
  • how do u expect to accomplish what you want to do without using shell or cron – Ryan Oct 19 '12 at 19:43
  • I don't expect anything I am asking if it is possible with php alone , there is this that runs senmail script in backend http://stackoverflow.com/questions/4626860/how-can-i-run-a-php-script-in-the-background-after-a-form-is-submitted and might be same as to what I need but I don't understand how – Benn Oct 19 '12 at 19:46

1 Answers1

0

Fund awesome reference

PHP Background Process Still Affecting Page Load

http://php.net/features.connection-handling#71172

header("Connection: close");
ob_start();
phpinfo();// or my page buffer previously saved in variable
$size=ob_get_length();
header("Content-Length: $size");
ob_end_flush();
flush();
file_get_contents('OF_THE_website_but_different_view');

works like charm

Community
  • 1
  • 1
Benn
  • 4,840
  • 8
  • 65
  • 106