How to parse a web page and use same session(?) to post ?

hi,
lets say there a web page requesting:
-username
-password
-sequence of letters ( assume its not an image, it is just plain text)
i can get the source of page and parse and find the sequence.
however i couldnt manage to post it. (the sequence changes)
any help would be great, thx..
        try {
            int statusCode;
            String urlAddress =  "mywebpage";
            HttpClient client = new org.apache.commons.httpclient.HttpClient();
            String key ="";
            URL url = new URL(urlAddress);
            URLConnection conn = url.openConnection();
            DataInputStream in = new DataInputStream ( conn.getInputStream (  )  ) ;
            BufferedReader d = new BufferedReader(new InputStreamReader(in));
            StringBuffer buffer = new StringBuffer();
            while(d.ready())
               buffer.append(d.readLine());
            int index = -1;
            String contents =buffer.toString();
            index = contents.indexOf("operation");
            while (index  > -1) {
                key  = key + contents.substring(index+10,index+11);
                index = contents.indexOf("operator", index+11);
            System.out.println(contents);
            System.out.println(key);
            /*GetMethod getMethod = new GetMethod(urlAddress);
            getMethod.getParams().setCookiePolicy(CookiePolicy.RFC_2109);
            statusCode = client.executeMethod(getMethod);
            if (statusCode != -1) {
                contents = getMethod.getResponseBodyAsString();
                index = -1;
                index = contents.indexOf("mp3sesler");
                while (index  > -1) {
                    key  = key + contents.substring(index+10,index+11);
                    index = contents.indexOf("operation", index+11);
                System.out.println(contents);
                System.out.println(key);
            PostMethod method = new PostMethod(urlAddress);
            // Configure the form parameters
            method.addParameter("user", "test");
            method.addParameter("pwd", key);
            // Execute the POST method
            statusCode = client.executeMethod(method);
            if (statusCode != -1) {
                contents = method.getResponseBodyAsString();
                method.releaseConnection();
                System.out.println(contents);
        } catch (Exception e) {
            e.printStackTrace();
        }

perhaps the website checks its source? What HTTP response do you get back?

Similar Messages

  • Creating a default web page and using WEB_API

    Hi ,
    I want to create a default html page to be displayed in html viewer control.Where I should create this html page and how to
    call this in my program.It is mentioned that
    'This page can be designed with the SAP web repository.' How to design this page with SAP web repository.
    Also it is mentioned that COM_PRDCAT_WEB_API(701) can be reused .Where to find this COM_PRDCAT_WEB_API.Can anyone help me out in this ?

    Use Tcode SMW0.
    The object  COM_PRDCAT_WEB_API which you mentioned is the package, i think its available only in 701 release.
    Goto SMW0 , press F8, you can see the SAP web repository objects.
    Raja

  • How to make all web pages not use mobile page

    I don't want to see the mobile web page. I want the desktop view. It seems to be grayed out.

    I have that installed but it still shows me the mobile version of the site. The desktop icon is grayed out.

  • How to parser a html page and get useful information?

    now ,I try to get the page by the url,after getting the whole page,
    is there any way to get the useful text ,and abandon other ,liks ,ad likes,
    other related links?
    I try to use java.util.regex.*;
    is there any other methods for dointg this?

    Regex isn't a good method unless your requirements are quite simple. In general if you want a Java HTML parser they are not hard to find -- "java html parser" is a good choice of keywords for an internet search.

  • How to establish a WEB page and obtain Domain

    I know that this is a very strange question to this forum, but I trust this group more than I do anyone else. I would like to set up a WEB site so that I can post many things on it, i.e. family tree, Shriner information, links to other folks. I have purchased IMac but have not used it yet.
    Is there a company out there that is in that type of business? And do I need to get a DOMAIN site?
    Would appreciate any information that you might provide.

    If you need help in creating web sites with iWeb, you should go to the iWeb forum:
    http://discussions.apple.com/forum.jspa?forumID=1193
    People there can also help regarding setting up a personal domain name, if you decide to buy one, which a great many users do. One good faq site is:
    http://alyeska.altervista.org/en/iWeb_FAQ.html

  • How can I view web pages in Segoe UI *Light*, please?

    I am looking for a way to make the Segoe UI Light font available to the Options dialogue in Firefox. I am already using this attractive font in Thunderbird.

    To Firefox, Segoe UI and Segoe UI Light are the same font family. The former is used for normal weight, while the latter is used for lighter weight.
    * https://developer.mozilla.org/en-US/docs/CSS/font-weight
    1. Install the Stylish add-on.
    * https://addons.mozilla.org/firefox/addon/stylish/
    2. If you want to ignore fonts specified by web pages and use Segoe UI Light for all elements if possible, paste the following in a new style and save it.
    <pre><nowiki>@namespace url(http://www.w3.org/1999/xhtml);
    @-moz-document url-prefix("http") {
    font-family: "Segoe UI" !important;
    font-weight: 300 !important;
    }</nowiki></pre>
    3. If you only want to use Segoe UI Light when the web page doesn't specify a particular font (e.g. Wikipedia), use the same style as above, but delete both instances of '''!important'''

  • How can I use Automator or AppleScript to get text from a web page and paste it in execl?

    I don't know how to make scripts or complexed automator workflows... that's why I'm asking.
    I'm trying to make a simple app or script to ask me what text to extract from a web page, like name, address and phone number of a web page and paste each one of these data in the righ cell of excel.
    I was thinking to promt a request from automator or an applescript to ask me which text to extract from the page or to look throught the HTML of the page to search for specific html tags, from which extracting text and then importing it, or paste it to the specified execl cell. Name in the name cell, address in the address cell and so on.
    Can somebody help me to make this script?
    If you know an alternative, like a software that already do this or another language to use, please tell.

    Try holding down the alt key as you mark the text to be copied. You can then copy columns to table text.

  • Whenever I open firefox a add ons screen comes up with the yahoo web page behind it. . I just want the Yahoo web page and do not want to close the add ons page every time I use my computer.

    Whenever I open firefox a add ons screen comes up with the yahoo web page behind it. . I just want the Yahoo web page and do not want to close the add ons page every time I use my computer.
    I don't know what else to say about this. It is a screen that comes up in its own window everytime I open Firefox

    Please check your home page setting and see if about:addons is listed. If it is, please remove it
    https://support.mozilla.com/en-US/kb/How+to+set+the+home+page

  • How do I enlarge my web page to use the whole screen?

    How do I enlarge my web page to use the whole computer screen?

    Reduce dock size or hide same.
    Also depends on what browser you're using  all have full screen modes.
    Safari :
    http://support.apple.com/kb/PH11941
    To enlarge an entire webpage so it uses the screen, click the arrows in the top-right corner of an app window:

  • 1. How can we search the Forum to see if a question has already been asked? 2. Can I send a Web Page and not just its Link?

    1. How can we search the Forum to see if a question has already been asked? Search goes back to Help and out of the Forum.
    2. Can I send a Web Page and not just its Link? Explorer allows it.

    1. How can we search the Forum to see if a question has already been asked? Search goes back to Help and out of the Forum.
    2. Can I send a Web Page and not just its Link? Explorer allows it.

  • Automated process to pull data from a web page without using VS and PS.

    Hello,
    I'm looking at finding a solution to pull data from an external web page and creating a list. I'm looking for a NON-POWERSHELL AND NON-VISUAL STUDIO solution. I am open to using InfoPath Designer.
    There exists a custom, non-SharePoint page built for us which has raw data. We've already created a custom list to match the data and now need to come up with a solution to automatically update the data. In this particular scenario, power shell and visual
    studio cannot be used.
    Thanks in advance.

    Why would you cripple yourself and restrict PowerShell at the very least which has perfect functionality for doing exactly that.
    I doubt you could use the InfoPath data sources to pull the raw data in, re-map it and save to SharePoint without resorting to some sort of coding within InfoPath.
    Please ensure that you mark a question as Answered once you receive a satisfactory response. This helps people in future when searching and helps prevent the same questions being asked multiple times.

  • How can I save the web page by using the Page Title as the file name ?

    When i use Internet Explorer ,I can save the web page by using Page Title as the file name(as default no need to adjust anything). But when i use Firefox ,It can not use the Page Title to save as the file name. How can I do that like in Internet Explorer?

    See:
    *File Title: https://addons.mozilla.org/firefox/addon/834
    *Title Save: https://addons.mozilla.org/firefox/addon/712

  • I made a mistake by saving a web page and moving it to ical on my mac air. now i can open ical but cant access it as it says i have a systems error . how do i fix it ?

    i made a mistake by saving a web page and moving it to ical on my mac air. now i can open ical but cant access it as it says i have a systems error . how do i fix it ?

    Changing body text is not simple. It's a desperate last resort. You need to buy the exact font. Acrobat will not let you edit in a font you don't own. Even then, it's undertain. Consider preparing an overlay in InDesign.

  • How can I get web page to retain button count values

    Hi,
    I have a button which, each time it is pressed increments a
    number. The number is shown in a text box. This all works fine, on
    my web page. However if I close the web page and then reopen it,
    the count number goes back to zero. How can I keep the number it
    was (eg 10) and keep incrementing it ?
    I have the button on Frame 1 and the text box on Frame 2.
    Thanks,
    Paul

    maith wrote:
    > Hi,
    > I have a button which, each time it is pressed
    increments a number. The
    > number is shown in a text box. This all works fine, on
    my web page. However if
    > I close the web page and then reopen it, the count
    number goes back to zero.
    > How can I keep the number it was (eg 10) and keep
    incrementing it ?
    > I have the button on Frame 1 and the text box on Frame
    2.
    You will need to use Shared Object to store the info on user
    drive.
    It is Flash's native form of cookies and works locally (from
    exe projector)
    as well as in browser.
    Best Regards
    Urami
    !!!!!!! Merry Christmas !!!!!!!
    Happy New Year
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

  • Creating a movie for a web page and making it continuously loop

    Hi all! I have a client who wants me to create a slide show with 7 images at a specific size for his web page. He wants it to continuously loop. I don't know much about this. Where can I go to learn how? I can make the movie... but I'm not sure what to export it as... and what the settings should be to enable me to make it the correct size and so that it loops. Thank you!
    I'm using iMovie '08 on my iMac.
    PS: When I looked up online for help, all I found was how to make a movie loop on one's computer. Not on web pages.

    .gif files are supported in all browsers and do not need any special "player". They are very limited in their support of colors and most Web pages rarely use them anymore.
    QuickTime .mov files can be set to "loop" (as explained above). Much more colors (millions).
    iMovie is the wrong tool to make your file (and it doesn't create .swf format).
    QuickTime Player Pro is the tool you need. It can import an "image sequence", set the frame rate (up to ten seconds per frame) and save the file in the .mov container.

Maybe you are looking for

  • Trouble getting iTunes to sync with music on my external hard drive

    PLEASE HELP ME! I recently moved all of my music to my external hard drive to free up space on my computer. I have all the original files on my hard drive now, but (perhaps stupidly) deleted all the files from my actual computer. Now, I'm afraid I ca

  • Imaq Display Control, zoom to fit disappeare​d at runtime.

    Like in the title. The right-click menu is impossible to call at runtime in the Imaq Display control. This has happened after compiling the code. Some idea why it is happen this? Francesco. Solved! Go to Solution.

  • How to implement fact tables with finest level of detail (fine-grained)?

    Hi, Maybe this is basic knowledge what I'm asking here... I don't know, well, here it goes: I need to know the way carry my transactional data to a fact table, but keeping the finest level of detail possible (namely, the transactions). I implemented

  • Lib/libz.so: could not read symbols: Invalid operation

    Hi, I am facing the following issue while compiling my code which is using gdcm lib in QT. The same source works fine in ubuntu but not here.... lQt5PrintSupport -lQt5OpenGL -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread /usr/bin/ld: /usr/local/lib/l

  • Production Notification to Delivery Department.

    Hi, I have a requirement which seems to have no standard SAP solution. Issue: 1. Customer service creates a (pick from stock) sales order with delivery date 06/27/2008. 2. Stock is missing, so SAP creates a stock production order with completion date