0

I am trying to get the content (text) from a website where I am a member, I found a plenty of examples of how to do this using cURL to login and get the context, however I am not sure how to handle with the redirection after I get log into the website. The result that I got from the code below is the login form (Example #1 here). I am wondering if I have no access is this really possible to do?

$postdata = http_build_query(
    array(
    'Account' => 'myaccount',
    'Password' => 'mypass'
    )
 );

$opts = array('http' =>
        array(
         'method'  => 'POST',
         'header'  => 'Content-type: application/x-www-form-urlencoded',
         'content' => $postdata
    )
  );

$context  = stream_context_create($opts);

$result = file_get_contents('http://www.website.php/login.php', false, 
$context);

After the login successful what I expect is to get the text from the redirected url which looks like http://www.website.php/other.php

Sora
  • 95
  • 1
  • 10

0 Answers0