her0satr Posted August 10, 2009 Share Posted August 10, 2009 I am try to make login script to wordpress with CURL, here my code : <?php define ('USER_AGENT', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.13) Gecko/2009073022 Firefox/3.0.13 (.NET CLR 3.5.30729)'); $Link = 'https://wordpress.com/wp-login.php'; $ArrayPost['log'] = 'username'; $ArrayPost['pwd'] = 'password'; $ArrayPost['testcookie'] = 1; $ArrayPost['redirect_to'] = 'http://wordpress.com/'; $ArrayPost['submit'] = 'Login'; $ArrayPost['rememberme'] = 'forever'; $RefererAddress = 'http://wordpress.com/'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $Link); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_USERAGENT, USER_AGENT); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_REFERER, $RefererAddress); curl_setopt($ch, CURLOPT_TIMEOUT, 20); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $ArrayPost); $ResultData = curl_exec($ch); curl_close($ch); echo $ResultData; exit; ?> I try pass my username and password for my wordpress account, but result is wrong cause result still on login page, it should contain my wordpress index page, could anyone help me please Link to comment https://forums.phpfreaks.com/topic/169568-login-script-wordpress-with-curl/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.