title: Parsehub API PHP
body: <p>How can I dump the results into a MySql db? 
  Specially decode gzip and parse it to an HP array then dump into a db.</p>
  
  <pre><code>&lt;?php
  
  $connection = mysqli_connect("localhost","root","Aruns@cal");
  if (!$connection) {
      die("Database connection failed: " . mysqli_error());
  }
  
  $db_select = mysqli_select_db($connection, "arunslocal");
  if (!$db_select) {
      die("Database selection failed: " . mysqli_error());
  }
  
  $params = http_build_query(array(
    "api_key" =&gt; "xxxxxxx",
    "format" =&gt; "JSON"
  ));
  
  $result = file_get_contents(
      'https://www.parsehub.com/api/v2/projects/tmnx0bN0Ty0U/last_ready_run/data?'.$params,
      false,
      stream_context_create(array(
          'http' =&gt; array(
              'method' =&gt; 'GET'
          )
      ))
  );
  
  echo "1"; 
  $arr = json_decode($result, true);
  echo "2"; 
  foreach((array)$arr as $item){
      echo "3"; 
      $name = $item['name'];
      $value = $item['value'];
      echo "4"; 
  
      $sql = "INSERT INTO `arunslocal`.`scrap_yielddata`( `yield_name`, `yield_value`) VALUES(1,3)";
      //$sql = "INSERT INTO `arunslocal`.`scrap_yielddata`( `yield_name`, `yield_value`) VALUES('$name','$value')";
  
          if(!mysqli_query($connection,$sql))
          {
              die('Error : ' . mysqli_error($connection));
          }
  
  
  
      }
  echo "5"; 
  ?&gt;
  </code></pre>
  
  <p>How can I dump the results into a MySql db? 
  Specially decode gzip and parse it to an HP array then dump into a db.</p>