title: Retrieve part of HTML code of page and set it as a session variable?
body: <p>I am currently trying to build a cURL to automatically log in to a test account at a certain website I am building. So far, so good - it logs me in and displays the first account page after the login sequence.</p>
  
  <p>What I would like to do, is the following:</p>
  
  <p>Retrieve the html code of that page, find a certain part of it and set it as a session variable.</p>
  
  <p>The part in question is:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;span class="welcome-user"&gt;&lt;span&gt;Welcome, Lakumba Lekendi&lt;/span&gt;&lt;a href="/signout?signOutMessage"&gt;Sign Out&lt;/a&gt;&lt;/span&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Any pointers on how I can achieve that? "Lakumba Lekendi" will not be a constant, since it will change for every user that logs in to their account. I literally wanna find the starting span tag ( class="welcome-user" ) and isolate all of its contents till the closing span tag.</p>
  
  <p>I suppose I can just grab the file contents via file_get_contents, but how do I find that specific piece of code in there, and isolate it properly to set it as a session variable?</p>