WordPress.org

Support

Support » How-To and Troubleshooting » Remote login using curl

Remote login using curl

Viewing 3 replies - 1 through 3 (of 3 total)
  • Mmm I don’t think curl or any other sort of php library will work for remote login. I tried doing a similar thing like you but the problem is wp-login needs to return a cookie to the client requesting machine. In this case since curl is making the reuqest (from the server) the client never gets the cookie and as such when you try visit wp-admin you get directed back to wp-login.

    I was able to do what you are trying to do using jquery and ajax. The down side is that the users browser must support javascript or it must be enabled.

    Ok thanks. Is the cookies set and working with different domains using ajax?

    Well it should work from any domain as some as you submit the right POST parameters to wp-login.php e.g

    wp-login.php?log=username&pwd=password&wp-submit=Log+In&testcookie=1

    If you use ajax you can submit this POST string e.g

    var dataString = log=username&pwd=password&wp-submit=Log+In&testcookie=1;
    $.ajax({
    type: “POST”,
    url: “/wp-login.php”,
    data: dataString,
    success: function() {
    //jquery example to update the form on success.
    $(‘#login_form’).html(“<div id=’message’></div>”);
    $(‘#message’).html(“<h2>Logged In!</h2>”);
    });
    }
    });
    return false;

    After your Ajax POST query has run, if you’re wordpress login was successful you should have a wordpress authentication cookie on your system which will let you use wp-admin.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Remote login using curl’ is closed to new replies.