I have the following PHP script which should get the content of a page, that is behind a login-form.
It is working fine on my localhost server, but it doesn\'t work
I solved it by first checking if open_basedir is set. If that is the case: the script first executes curl_exec() to set the cookies and then executes it again to get the hidden page. Parameters like op and form_build_id aren't used at all :P
Code:
if (ini_get('open_basedir') == '') {
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
$postResult = curl_exec($ch);
curl_close($ch);
} else {
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_exec($ch);
$postResult = curl_exec($ch);
}