title: Get data from Fingerprint device using PHP
body: <p>I am working on attendance application using PHP and MySQL, I want to automate the attendance process by getting all data from fingerprint devices directly and import them into MySQL database through PHP script.</p>
  
  <p>I googled and found a script which uses PHP SOCKETS to retrieve data through device IP (<a href="http://dnaextrim.github.io/php_zklib/" rel="nofollow noreferrer">Link</a>):</p>
  
  <pre><code>$ cd your_repo_root/repo_name
  $ git fetch origin
  $ git checkout gh-pages
  </code></pre>
  
  <p>The problem is the data looks messy, not complete and there's a lot of decryption through library functions.</p>
  
  <p>I also tried the CURL, but it's not working (<a href="http://newbiebehappy.blogspot.com/2013/09/php-tutorial-get-data-from-finger-print.html" rel="nofollow noreferrer">Link</a>):</p>
  
  <pre><code>$number="";
      for($i=1;$i&lt;=100;$i++){
        $number.=($i.",");
      }
      $number=substr($number,0,strlen($number)-1);
      $url = "http://192.168.2.201/form/Download?uid=".$number."&amp;sdate=2013-09-10&amp;edate=2013-09-10";
  
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL,$url);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  
      $server_output = curl_exec ($ch);
  
      curl_close ($ch);
  
      $data = array();
      $record = explode("\n",$server_output);
      foreach($record as $r){
        $r = str_replace("\t"," ",$r);
        $isi = explode(" ",$r);
        array_push($data, $isi);
      }
  
      print_r($data);
  </code></pre>
  
  <p>Is there's any other ways that I can get all the data from fingerprint through PHP, as the provider of the device doesn't provide any PHP SDK for it.</p>
  
  <p>Fingerprint type: Granding</p>
  
  <p>Available SDKs: C# and ASP.NET</p>