title: How to detect mobile device and get user agent info send and save that information to database on server, only once?
body: <p>Is there any script to check user agent then send and save that information to database on server?</p>
  
  <p>I'm making mobile website with 2 versions like <em>m.facebook.com</em> and <em>touch.facebook.com</em> and I want to redirect to different mobiles. and I use <strong>WURFL</strong> device detection.</p>
  
  <p>So for example m.html5version.com should be delivered to all HTML5 supported devices and <em>m.mobileversion.com</em> should deliver to all other mobiles.</p>
  
  <p>So i need a way to detect device and browser 1st time using any server-side or client-side method. when any user will open the website first time on device then an script should run once it should collect the information about device and browser and should save the information in my existing WURFL database , so next time when any user will come from same device then he will redirect to touch or mobile version of website depending on device.</p>
  
  <p>So only 1st time on 1st device I want to detect device and save the info.</p>
  
  <p>Is there any way to do this?</p>
  
  <p><strong>For example</strong> </p>
  
  <p>Android 1.6 doesn't have HTML5 support and still in use. So i want to redirect all Android 1.6 devices to <em>m.mobileversion.com</em> not to <em>touch.mobileversion.com</em> </p>
  
  <p>And in touch version of website I'm using HTML 5 tags like <code>&lt;header&gt;</code>, <code>&lt;footer&gt;</code>, <code>&lt;nav&gt;</code> etc which is not supported Android 1.6. So i want to detect the first device who will access the website from Android 1.6 device and because HTML5 is not supported in 1.6 so user agent should be saved in my database then I when next time any user will open the website in 1.6 it will redirect to lo-fi mobile version automatically, no detection should be needed 2nd time for any device.</p>