title: Laravel - Save HTML Dom-Parser response to database
body: <p>I have managed to get some HTML from a website using HTMLDomParser (<a href="http://simplehtmldom.sourceforge.net/" rel="nofollow noreferrer">http://simplehtmldom.sourceforge.net/</a>):</p>
  
  <pre><code>$html = HtmlDomParser::file_get_html('https://example.com/id=1');
  </code></pre>
  
  <p>This results in the following HTML:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;p&gt; ANDE 2, the Atmospheric Neutral Density Experiment 2, is a pair of microsatellites (Castor and Pollux) launched from Cape Canaveral on STS 127 on 15 July 2009 at 22:03 UT and deployed from the payload bay of the shuttle on 30 July 2009 at 17:22 UT.&lt;/p&gt;
  &lt;p&gt;&lt;strong&gt;Launch Date:&lt;/strong&gt; 2009-07-15&lt;br/&gt;&lt;strong&gt;Launch Vehicle:&lt;/strong&gt; Shuttle&lt;br/&gt;&lt;strong&gt;Launch Site:&lt;/strong&gt; Cape Canaveral, United States&lt;br/&gt;&lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>What I want to attempt to do is to take this HTML and save it to a mySQL database. So, in the database I will have four columns: </p>
  
  <ul>
  <li>Description</li>
  <li>Launch Date</li>
  <li>Launch Vehicle</li>
  <li>Launch Site</li>
  </ul>
  
  <p>The HTML layout will always stay the same. My other database contains the <code>id</code>'s for the URL's. I am able to replace the <code>id=1</code> with a variable, so I would be able to manage to save multiple webpage data. </p>
  
  <p>The only thing I am worrying about if the <code>id</code> does not exist. Would it be possible just to skip that page if it cannot find the HTML it is looking for?</p>
  
  <p>I have never done this before, so I am a bit overwhelmed by this. Would it even be possible to do this?</p>
  
  <p>Basically, I just want to save data from a DomParser into my database.</p>
  
  <p><strong>EDIT:</strong> Since there has not been an answer, I think we need to tackle this systematically - first we should try creating the function that saves the data to the database. </p>
  
  <p><strong>EDIT 2:</strong> I was just thinking - maybe the function that needs to save the HTML can split the result from HTMLDomParser by tag ('strong', 'p', etc.) and create a variable for each column and then save it. I guess the question here first is how do you split the HTML?</p>
  
  <p><strong>EDIT 3:</strong> Since I did not receive any answers / suggestions, I am guessing it is very complex to implement this. I still have not managed to come up with anything that saves the HTML successfully to my database.</p>