title: Schedule scripts without using CRON
body: <p>I know there are many posts about using CRON to run a php file.  But, in the world of shared hosting, and ease of setup for a user, I don't want to have to mess with that.</p>
  
  <p>I found another solution online that has to do with sockets.  Just wanted to get everyones take on this, and tell me if this is a good or bad idea.  Sounds like it works well.</p>
  
  <p>Thoughts?</p>
  
  <pre><code>//Open socket connection to cron.php
  $socketcon = fsockopen($_SERVER['HTTP_HOST'],80,$errorno,$errorstr,10);
  if($socketcon) {
  $socketdata = "GET /cron.php HTTP 1.1\r\nHost: ".$_SERVER['HTTP_HOST']."\r\nConnection: Close\r\n\r\n";
  fwrite($socketcon,$socketdata);
  //Normally you would get all the data back with fgets and wait until $socketcon reaches feof.
  //In this case, we just do this:
  fclose($socketcon);
  } else {
  //something went wrong. Put your error handler here.
  }
  </code></pre>
  
  <p>cron.php:</p>
  
  <pre><code>//This script does all the work.
  sleep(200);
  //To prove that this works we will create an empty file here, after the sleep is done.
  //Make sure that the webserver can write in the directory you're testing this file in.
  $handle = fopen('test.txt','w');
  fclose($handle);
  </code></pre>
  
  <p>Found the script from a blog post: <a href="http://syn.ac/tech/13/creating-php-cronjobs-without-cron-and-php-cli/" rel="noreferrer">http://syn.ac/tech/13/creating-php-cronjobs-without-cron-and-php-cli/</a></p>