I looked through Stack Overflow for similar questions but found only pieces of information. So my problem is this:
I want to grab the content of a page let's say : needpage.php (using file_get_contents() + stream_context_create() or using cURL() ) but the page that I need redirects me to a login page ( loginpage.php - <form action=*processlogin.php*> with user and pass).
Do I need to cURL() or file_get_contents() the processlogin.php page first to POST the username and password field, then grab the sessionID and then send another request to the needpage.php I need posting:
$opts = array(
'http' => array(
'method' => 'GET',
'header' => 'Cookie: PHPSESSID=0123456789abcdef0123456789abcdef'
)
);
What do you think is the right flow? Is it possible that cURL or file_get_contents to store the cookie and then use that cookie for another page?