我遇到了会话问题。问题是我可以通过登录面板连接到网站,但毕竟当我点击其他链接到网站时,就好像我没有登录网站。那么,我如何编码以保持在线网站的东西?我该怎么办?
<?php
function login ($url,$information){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION,true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $information);
curl_setopt($curl, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($curl, CURLOPT_COOKIEFILE, "cookie.txt");
curl_exec($curl);
curl_close($curl);
}
login("http://www.na.edu/online/login/index.php","username=user&password=blablabla");
?>