How to remotely log in and call an API?
<p>Let's abstract away the difficulties of the world and suppose that this fellow here has currently one HTML page with two forms in his arsenal. They look like this:</p>

<pre><code> &lt;form method="POST" action="foobar.com/login"&gt; ...
 &lt;form method="POST" action="foobar.com/getstuff"&gt; ...
</code></pre>

<p>The first logs in a remote server, setting cookies and so on, and the second one sends a request to that server to show data.</p>

<p>How can I accomplish this task in PHP, logging in and fetching the data in a single page load? </p>
