Master, about curl simulated login this post was last edited by dz215136304 at 2013-04-0410: 25: 43 simulate login dream, version 5.7, has removed the background verification code, I don't know why I couldn't log on all the time (prompting that the login was successful but jumping back to the login address) & lt ;? Php experts, about curl simulated login
At the end of this post, dz215136304 edited the simulated login dream at 10:25:43 on. version 5.7 has removed the background verification code. I don't know why I have been unable to log on all the time (prompting that the login was successful but I jumped back to the login address again)
$cookie_file = tempnam('./temp','cookie');
$login_url = 'http://localhost/dedecms/dede/login.php';
$post_fields = 'gotopage=%2Fdedecms%2Fdede%2Findex.php&dopost=login&adminstyle=newdedecms&userid=admin&pwd=123456&sm1=';
$ch = curl_init($login_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
curl_exec($ch);
curl_close($ch);
$url='http://localhost/dedecms/dede/article_add.php?channelid=1';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
$contents = curl_exec($ch);
curl_close($ch);
?>
Share:
------ Solution --------------------
Restrictions on the dede login class