function loginpage($loginurl, $loginset, $agent, $cookie){
$options = array(
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_COOKIESESSION => true,
CURLOPT_CONNECTTIMEOUT => 120,
CURLOPT_USERAGENT => $agent,
CURLOPT_TIMEOUT => 120,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_RETURNTRANSFER => true,
//CURLOPT_REFERER => 1,
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_POSTFIELDS => $loginset,
CURLOPT_POST => 1,
CURLOPT_COOKIEJAR => $cookie,
//CURLOPT_COOKIE => $strCookie,
//CURLOPT_COOKIEFILE => $cookie,
);
$ch = curl_init( $loginurl );
CURL_SETOPT_ARRAY( $ch, $options );
$result = curl_exec( $ch );
$err = curl_errno( $ch );
$errmsg = curl_error( $ch );
$header = curl_getinfo( $ch );
curl_close( $ch );
return $result;
}
$username = "myusername...";
$password = "mypassword...";
$loginurl = "http://up.4share.vn/?control=login";
$loginset = "inputUserName=$username&inputPassword=$password";
$cookie = "/uploads/4shareVN_cookie.txt" ;
$agent = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36";
$loginpage = loginpage($loginurl, $loginset, $agent, $cookie);
echo $loginpage;
使用此代码,我可以使用我的帐户 cURL 并登录到:http ://up.4share.vn/?control=login
我的问题是如何保持登录并转到该网站的另一个页面
例如:http ://up.4share.vn/?control=account_info
并在php中显示它,请有人帮忙。