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.
What I would like to do, is the following:
Retrieve the html code of that page, find a certain part of it and set it as a session variable.
The part in question is:
<span class="welcome-user"><span>Welcome, Lakumba Lekendi</span><a href="/signout?signOutMessage">Sign Out</a></span>
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.
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?