title: dompdf form not working properly in secure server (ssl)
body: <p>I created a form using dompdf and when I uploaded it to the regular server the website belongs to, it worked fine. However, when I moved it to a secure server (ssl) it didn't work and didn't send the form. The server runs Linux. The webserver is Nginx with FastCGI. Any ideas about what could be going on? I just get an error message from the form saying that not all the mandatory fields have been filled, but there's only two and I filled them.</p>
  
  <pre><code>2015/09/10 22:07:35 [error] 14522#0: *1509 FastCGI sent in stderr: "PHP 
  message: PHP Warning: strip_tags() expects parameter 1 to be string, 
  array given in 
  /var/www/nuweights.net/html/patient_registration_form/form.php on line 13
  PHP message: PHP Warning: strip_tags() expects parameter 1 to be 
  string, array given in 
  /var/www/nuweights.net/html/patient_registration_form/form.php on line 13
  PHP message: PHP Notice: Undefined property: stdClass::$prim_phone in 
  /var/www/nuweights.net/html/patient_registration_form/pdf.php on line 
  180" while reading response header from upstream, client: 72.83.230.123, 
  server: nuweights.net, request: "POST 
  /patient_registration_form/form.php HTTP/1.1", upstream: 
  "fastcgi://unix:/var/run/php5-fpm.sock:", host: "ssl.nuweights.net", 
  referrer: "https://ssl.nuweights.net/patient_registration_form/form.php"
  </code></pre>
  
  <p>This is the code for the php file. If I need more validation, how can I add it? what would be the code for that?</p>
  
  <pre><code>&lt;?php
  if (!empty($_POST)) {
  
  // Used for later to determine result
  $success = $error = false;
  
  // Object syntax looks better and is easier to use than arrays to me
  $post = new stdClass;
  
  // Usually there would be much more validation and filtering, but this
  // will work for now.
  foreach ($_POST as $key =&gt; $val)
  $post-&gt;$key = trim(strip_tags($_POST[$key]));
  
  // Check for blank fields
  if (empty($post-&gt;first_name) OR empty($post-&gt;last_name))
      $error = true;
  else {
  
      // Get this directory, to include other files from
      $dir = dirname(__FILE__);
  
      // Get the contents of the pdf into a variable for later
      ob_start();
      require_once($dir.'/pdf.php');
      $pdf_html = ob_get_contents();
      ob_end_clean();
  
      // Load the dompdf files
      require_once($dir.'/dompdf/dompdf_config.inc.php');
      $dompdf = new DOMPDF(); // Create new instance of dompdf
      $dompdf-&gt;load_html($pdf_html); // Load the html
      $dompdf-&gt;render(); // Parse the html, convert to PDF
      $pdf_content = $dompdf-&gt;output(); // Put contents of pdf into variable for later
  
      // Get the contents of the HTML email into a variable for later
      ob_start();
      require_once($dir.'/html.php');
      $html_message = ob_get_contents();
      ob_end_clean();
  
      // Load the SwiftMailer files
      require_once($dir.'/swift/swift_required.php');
  
      $mailer = new Swift_Mailer(new Swift_MailTransport()); // Create new instance of SwiftMailer
  
      $message = Swift_Message::newInstance()
                     -&gt;setSubject('Patient Registration Form') // Message subject
                     -&gt;setTo(array('info@hotmail.com' =&gt; 'Sam')) // Array of people to send to
                     -&gt;setFrom(array('no-reply@net.tutsplus.com' =&gt; 'PRF')) // From:
                     -&gt;setBody($html_message, 'text/html') // Attach that HTML message from earlier
                     -&gt;attach(Swift_Attachment::newInstance($pdf_content, 'reg_form.pdf', 'application/pdf')); // Attach the generated PDF from earlier
  
      // Send the email, and show user message
      if ($mailer-&gt;send($message))
          $success = true;
      else
          $error = true;
  
       }
  
   }
   ?&gt;
  </code></pre>