Not sure if this should be here or in the windows forum. We have a website that is on a windows server. I'm trying to keep this site in the server memory so it always loads fast. I have a script right now that runs and checks the server response. What I don't get is why this isn't keeping the site alive? Can someone please explain why and give me a concept on how I can keep the site alive? I don't need the code, I can do that part. Here's what I do right now.
$site = 'http://example.com';
$agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";$ch=curl_init();
curl_setopt ($ch, CURLOPT_URL,$site );
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch,CURLOPT_VERBOSE,false);
curl_setopt($ch, CURLOPT_TIMEOUT, 240);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch,CURLOPT_SSLVERSION,3);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, FALSE);
$page=curl_exec($ch);
//echo curl_error($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if($httpcode>=200 && $httpcode<=301){
return true;
}
else{
return false;
}