title: Paas Excel sheet data in array and send to model using Codeigniter
body: <p>I am using PHPExcel for uploading large amount data file. While uploading the excel sheet it display the error :</p>
  
  <blockquote>
    <p>Fatal error: Maximum execution time of 30 seconds exceeded</p>
  </blockquote>
  
  <p>because I am sending data through foreach loop and it takes time for uploading. Now I want to send data in array form. I am using following code in <strong>Controller file:</strong></p>
  
  <pre><code>    $inputFileName = $_FILES['SMSFile']['tmp_name']; 
                          $reader = ReaderFactory::create(Type::XLSX);
                          $reader-&gt;open($inputFileName);
                          $count = 1;
  
                          foreach ($reader-&gt;getSheetIterator() as $sheet) {
                              foreach ($sheet-&gt;getRowIterator() as $row) {
                                  if ($count &gt; 1) { 
                                   $ddate=$row[4]-&gt;format('d-M-Y');
                                   $ddate1=$row[5]-&gt;format('d-M-Y');
  
                                      $arr[]= array(
                                                  'DISTName' =&gt; $row[0],              
                                                  'contactNo' =&gt; $row[1],
                                                  'sepecification' =&gt; $row[2],    
                                                  'POD' =&gt; $row[3],                                           
                                                  'dispatchDate' =&gt; $ddate,
                                                  'ExpectedDate' =&gt;$ddate1                                                     
                                              );
  
                                  $to=$row[1];    
                                  $Distinct=  $row[0];
                                  $sepecification =$row[2];
                                  $poid = $row[3];
                                  $dispatchDate = $ddate; 
                                  $ExpectedDate = $ddate1;
                                  $SMSUser = 'abx';
                                  $password = 'abxx';
                                  $sid = 'ABC';
                                  $message = "Dear Sir,\nDist: $Distinct \nSepecification: $sepecification \nPOD: $poid \nDispatch Date: \n$dispatchDate \nExpected Delivery: \n$ExpectedDate";           
  
  
                                      $sendSMS = $this-&gt;SendSMS-&gt;sendSMS($SMSUser, $password, $message, $to, $sid);           
  
                                   }
  
  
  
                                  $count++;
  
                              }
  
                          $reader-&gt;close(); 
                          }
  </code></pre>
  
  <p><strong>Model file</strong></p>
  
  <pre><code>  public static function sendSMS($user, $password, $message, $to, $sid) {
      $fl = 0;
      $gwid = 2;
      //Prepare you post parameters
      $postData = array(
          'user' =&gt; $user,
          'password' =&gt; $password,
          'msisdn' =&gt; $to,
          'sid' =&gt; $sid,
          'msg' =&gt; $message,
          'fl' =&gt; $fl,
          'gwid' =&gt; $gwid,
      );
      //API URL
      $url="http://sms.example.in:8080/abc/xyz.aspx";
  
      // init the resource
      $ch = curl_init();
      curl_setopt_array($ch, array(
          CURLOPT_URL =&gt; $url,
          CURLOPT_RETURNTRANSFER =&gt; true,
          CURLOPT_POST =&gt; true,
          CURLOPT_POSTFIELDS =&gt; $postData
      ));
      //Ignore SSL certificate verification
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
      //get response
      $output = curl_exec($ch);
      //Print error if any
      if(curl_errno($ch))
      {
          echo 'error:' . curl_error($ch);
      }
      curl_close($ch);  
  }
  </code></pre>