I need to export current DNN website to static HTML pages. I tried curl PHP code but the issue is I can never successfully login and preserve the session. The response is always the login page.
My code is below. Thank you for all your help in advance.
$ckfile = tempnam ("/temp", 'cookie.txt');
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_COOKIEJAR=> $ckfile,
CURLOPT_COOKIEFILE=> $ckfile,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'https://www.phenx.org/Default.aspx?tabid=36&ctl=Login',
CURLOPT_USERAGENT => 'Codular Sample cURL Request',
CURLOPT_POST => 1,
CURLOPT_HEADER =>1,
CURLOPT_HTTPHEADER, array(
'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2',
'Accept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml',
'Content-Type: application/json',
'Accept-Language: en-gb,en;q=0.5',
'Proxy-Connection: Close',
'Cache-Control: max-age=0'
),
CURLOPT_POSTFIELDS => array(
dnn_ctr_Login_Login_DNN_txtUsername => 'USERNAME',
dnn_ctr_Login_Login_DNN_txtPassword => 'PASSWORD',
dnn_ctr_Login_chkCookie =>'1'
)
));
// Send the request & save response to $resp
$response = curl_exec($curl);