smatts Posted February 10, 2007 Share Posted February 10, 2007 Ok I am trying to login to my Wordpress site from another site using cURL. I am new to cURL and can not understand why this is not working: <?php $postData = array(); $postData['log'] = "username"; $postData['pwd'] = "blahblah"; $postData['submit'] = "submit"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.wordpress.com/wp-login.php" ); curl_setopt($ch, CURLOPT_COOKIEJAR, cookie.txt); curl_setopt($ch, CURLOPT_COOKIEFILE, cookie.txt); curl_setopt($ch, CURLOPT_POST, 1 ); curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $postResult = curl_exec($ch); if (curl_errno($ch)) { print curl_error($ch); } curl_close($ch); ?> I want it to fill out the form and submit it so I am logged in. Also with the cookie files, do I need to make one or where should I be pointing those to? Thanks. Link to comment https://forums.phpfreaks.com/topic/37900-curl-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.