Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 23rd, 2007, 08:29 AM
Authorized User
 
Join Date: Jun 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ajit
Default Set-Cookie: PHPSESSID=deleted

HI, I am trying to login to http://www.ryze.com with the following code,
Code:
public class RyzeLogin {
    public static void main(String args[]){
        RyzeCookieListner cookieListner = new RyzeCookieListner();
        HttpUnitOptions.setLoggingHttpHeaders(true);
        CookieProperties.addCookieListener(cookieListner);
        WebConversation webConversation = new WebConversation();
        webConversation.getClientProperties().setAutoRedirect(true);
        webConversation.getClientProperties().setAutoRefresh(true);
        webConversation.getClientProperties().setAcceptCookies(true);
        webConversation.getClientProperties().setAcceptGzip(false);
        webConversation.getClientProperties().setIframeSupported(true);
        webConversation.setUserAgent("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4");

        try{
            WebRequest webRequest = new GetMethodWebRequest("http://www.ryze.com");
            WebResponse webResponse = webConversation.sendRequest(webRequest);

            // Get the form and login
            WebForm form = webResponse.getFormWithName("form1");
//            System.out.println(form.getClassName());
            form.setParameter("flogin","ajithsowkoor");
            form.setParameter("fpassword","regalix");
            form.submit();

            webResponse = webConversation.getCurrentPage();
            writeToOut(webResponse, "web/RyzeHome.html");
        }catch(Exception ex){
            System.out.println(ex.toString());
        }
    }
    private static void writeToOut(WebResponse webResponse, String file) throws Exception{
        InputStream is = webResponse.getInputStream();
        byte[] b = new byte[is.available()];
        is.read(b);

        FileOutputStream fout = new FileOutputStream(file);
        fout.write(b);
        fout.close();    
    }
    static class RyzeCookieListner implements CookieListener{
        public void cookieRejected(String cookieName, int reason, String attribute){            
            try    {
                FileOutputStream fileOutputStream = new FileOutputStream("Log/Rejectedcookie.txt", true);
                fileOutputStream.write((cookieName + ": "+ reason).getBytes());
                fileOutputStream.close();
            }catch (IOException ioeX) {
                System.out.println(ioeX.toString());
            }
        }
    }
}
But I could not login and the console displays the below message,

Connecting to www.ryze.com
Sending:: GET http://www.ryze.com
Sending:: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4

Received from http://www.ryze.com
Rhino classes (js.jar) not found - Javascript disabled
Header:: HTTP/1.1 200 OK
Header:: Date: Tue, 23 Oct 2007 13:00:24 GMT
Header:: Server: Apache/1.3.37 (Unix) PHP/5.1.4 mod_ssl/2.8.28 OpenSSL/0.9.7a
Header:: X-Powered-By: PHP/5.1.4
Header:: Set-Cookie: PHPSESSID=deleted; expires=Mon, 23-Oct-2006 13:00:23 GMT; path=/; domain=.ryze.com
Header:: Keep-Alive: timeout=15
Header:: Connection: Keep-Alive
Header:: Transfer-Encoding: chunked
Header:: Content-Type: text/html
!!!!!!!!!!!!!!!!!!!!!www.ryze.com
!!!!!!!!!!!!!!!!!!!!!.ryze.com

Connecting to www.ryze.com
Sending:: GET common.js
Sending:: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4
Sending:: Cookie: PHPSESSID=deleted

Received from http://www.ryze.com/common.js
Header:: HTTP/1.1 200 OK
Header:: Date: Tue, 23 Oct 2007 13:00:26 GMT
Header:: Server: Apache/1.3.37 (Unix) PHP/5.1.4 mod_ssl/2.8.28 OpenSSL/0.9.7a
Header:: Last-Modified: Fri, 25 Jun 2004 10:36:08 GMT
Header:: ETag: "1a6866e-7b3-40dc0018"
Header:: Accept-Ranges: bytes
Header:: Content-Length: 1971
Header:: Keep-Alive: timeout=15
Header:: Connection: Keep-Alive
Header:: Content-Type: application/x-javascript

Connecting to www.ryze.com
Sending:: POST loginprocess.php
Sending:: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4
Sending:: Cookie: PHPSESSID=deleted
Sending:: Referer: http://www.ryze.com
Sending:: Content-Type: application/x-www-form-urlencoded

Received from http://www.ryze.com/loginprocess.php
Header:: HTTP/1.1 200 OK
Header:: Date: Tue, 23 Oct 2007 13:00:27 GMT
Header:: Server: Apache/1.3.37 (Unix) PHP/5.1.4 mod_ssl/2.8.28 OpenSSL/0.9.7a
Header:: X-Powered-By: PHP/5.1.4
Header:: Set-Cookie: PHPSESSID=deleted; expires=Mon, 23-Oct-2006 13:00:26 GMT; path=/; domain=.ryze.com
Header:: Set-Cookie: PHPSESSID=deleted; expires=Mon, 23-Oct-2006 13:00:26 GMT; path=/; domain=.ryze.com
Header:: Expires: Thu, 19 Nov 1981 08:52:00 GMT
Header:: Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Header:: Pragma: no-cache
Header:: Set-Cookie: asclogin=ajithsowkoor; path=/; domain=.ryze.com
Header:: Set-Cookie: ascpassword=%241%24EdnDKXDF%24fTj9imbADU0fOlrdUF4l g.; path=/; domain=.ryze.com
Header:: Set-Cookie: asclogin=ajithsowkoor; path=/; domain=www.ryze.com
Header:: Set-Cookie: ascpassword=%241%24EdnDKXDF%24fTj9imbADU0fOlrdUF4l g.; path=/; domain=www.ryze.com
Header:: Keep-Alive: timeout=15
Header:: Connection: Keep-Alive
Header:: Transfer-Encoding: chunked
Header:: Content-Type: text/html
!!!!!!!!!!!!!!!!!!!!!www.ryze.com
!!!!!!!!!!!!!!!!!!!!!.ryze.com
!!!!!!!!!!!!!!!!!!!!!www.ryze.com
!!!!!!!!!!!!!!!!!!!!!.ryze.com
!!!!!!!!!!!!!!!!!!!!!www.ryze.com


Can anybody kindly help me out, Plz.....

Ajit
__________________
Ajit





Similar Threads
Thread Thread Starter Forum Replies Last Post
set the cookie file name crmpicco Javascript How-To 4 February 17th, 2006 05:04 AM
Set Cookie Chapter 8 ? phirun BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 13 May 27th, 2005 11:19 AM
Problem with set cookie chapter 8 stephen_c_ BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 December 15th, 2004 02:35 PM
Set Cookie rowlandk Beginning PHP 5 April 6th, 2004 01:18 PM
getting set cookie value from a script abbylee26 Javascript 1 July 17th, 2003 03:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.