I am using this code to execute one command:
$fp = fsockopen($domain, 80, $errno, $errstr);
if (!$fp) { echo "$errstr ($errno)<br>\n"; } else {
$out = "GET ".$_SERVER['PHP_SELF']."?com=cache&pass=$password HTTP/1.1\r\n";
$out .= "Host: $domain\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)){
echo fgets($fp,32000);
}
This code works, it does indeed sends the GET request properly. But when I execute this code directly from the web browser, the "com=cache" command is beign processed in the real time just like if I executed it directly and not through fsockopen.
What I'd like to do is to 'force' the server to send the GET request, finish the job on the server and then notify me via email (for example) when the job is done. The reason for this is that the "cache" command can take several hours to finish.
I hope I explained it good enough... The point is, the work should be done "silently" on the server just like if the code was executed through Cron job.
Thanks!
Tomas