Unable to login wordpress.com by using standalone java program.

  • Author
    Posts
  • #16470

    sadashiv
    Member

    Hi,

    I want to navigate http://wordpress.com/ by using stand alone java program. I am using HttpUnit for navigation, but i am unable to login http://wordpress.com.

    WordPress uses HTTPS protocol for authentication. I don’t know whether this problem comes because of https protocol or is there any other problem ?

    By using the same program, I am able to login and navigate typepad.com which also uses HTTPS protocol.

    I am not getting why I am facing this problem only for WordPress.com.

    If anybody have gone through this problem or knows the solution of this problem then please reply.

    Thanks in advance!!!

    Regards,
    Sadashiv

    #16592

    drmike
    Member

    When you say you’re unable to login, are you getting some form of error? What specific page are you trying to log in? Is it even acknoliging that you’re making the attempt to log in? What API does the program use if any?

    From their non existant program description and my flipping through their docs trying to figure out what this thing does, I gather you’re trying to test some sort of program on your end and HttpUnit is some sort of overlapping test script. Am I close?

    #16620

    sadashiv
    Member

    Hi drmike,

    I am not getting any sort of error. Instead of sending request to particular page, server redirects request internally to login page. Following is the sample code that i wrote. For this I am using HttpUnit.

    WebConversation wc = new WebConversation();

    ClientProperties clProp = ClientProperties.getDefaultProperties();
    clProp.setAcceptGzip(true);
    clProp.setAutoRedirect(true);
    clProp.setAcceptCookies(true);
    HttpUnitOptions.setExceptionsThrownOnScriptError(false);
    HttpUnitOptions.setLoggingHttpHeaders(true);

    WebRequest request = new PostMethodWebRequest(“http://wordpress.com”);
    WebResponse response = wc.getResponse( request );
    WebForm loginForm = response.getFormWithName(“loginForm”);

    request = loginForm.getRequest();
    System.out.print(“Action : ” + loginForm.getAction());
    request.setParameter(“log”,”username”);
    request.setParameter(“pwd”,”password”);
    response = loginForm.submit();

    // find the link which contains the string “My Dashboard” and click it
    /*
    WebLink httpunitLink = response.getFirstMatchingLink( WebLink.MATCH_CONTAINED_TEXT, “My Dashboard” );
    response = httpunitLink.click();
    */
    System.out.println(“****** ” + response.getResponseCode());
    System.out.println(“****** ” + response.getText());

    when i run this code, it returns response as main login page instead of the page that i want. when i give wrong username and password it returns as expected “invalid login” page. But when i give correct username and password it returns main login page as response, that is unexpected, it should return dashboard page.

    Thanks,
    Sadashiv

    #16622

    Sadashiv, you should visit http://automattic.com/ and query the developers directly. Here on the forums, we like our questions easy-to-answer and ambiguously worded (just kidding). Otherwise, I’m assuming that you can access wp.com using the MetaWeblog API: http://www.xmlrpc.com/metaWeblogApi.

    #16642

    drmike
    Member

    Hey how did you know I was looking for a copy of the MetaWeblog API yesterday? :)

    I’m still working on my crossposter

The topic ‘Unable to login wordpress.com by using standalone java program.’ is closed to new replies.