2

I'm currently seeking a solution to logging into Wordpress using PHP/Javascript, I have found examples using cURL but none of them seem to be working for me as of right now (and many of the cURL examples are dated 2009 and earlier). I was wondering if anyone had an idea of how to log onto Wordpress using PHP, perhaps with an updated cURL example? I am using Wordpress version 3.2.1.

Thanks in advance.

1
  • 1
    what exactly do you want to do? there is XMLRPC access as an alternative. Commented Nov 6, 2011 at 11:10

1 Answer 1

1

As it appears this question has not been answered yet (for 9 months), I'll state my solution.

For anyone particularly interested in WordPress's brute-forced login protocol without the hassle of XMLRPC access:

<?php
    require_once('path/to/wp-blog-header.php');
    wp_set_current_user($ID, $user_login);
    wp_set_auth_cookie($ID);
    do_action('wp_login', $user_login);
?>

Caveat: $user_login is not of particular importance - it is used for setting up the session authentication cookie. It is advised that this be randomized for unique values.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.