Read Source code of a Web Page

Hi,
Could anyone suggest an ABAP Function module which when given a web page URL as input downloads the source code of the web page into an internal table. Thanks.
Regards,
Prabaharan.

Hi,
Chek this link:
Extracting data from a HTML / XML web page
Hope it helps you.
Pleae reward helpful answers.
Best Regards,
Anjali

Similar Messages

  • Retrieving HTML source code of a web page

    Hi,
      I want to take the HTML source code of a web page. How can I take?
    Thanks and regards,
    Venkat.

    You can do that with the class "cl_http_client".
    Sample code:
    DATA: http_client TYPE REF TO if_http_client .
    DATA: w_string TYPE string ,
    w_result TYPE string ,
    r_str TYPE string .
    DATA: result_tab TYPE TABLE OF string.
    START-OF-SELECTION .
    CLEAR w_string .
    w_string = 'http://urlhost/Logs/main.asmx/SetLog'.
    CALL METHOD cl_http_client=>create_by_url
    EXPORTING
    url                = w_string
    IMPORTING
    client = http_client
    EXCEPTIONS
    argument_not_found = 1
    plugin_not_active  = 2
    internal_error     = 3
    OTHERS = 4.
    CALL METHOD HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
    EXPORTING
    NAME = '~request_method'
    VALUE = 'POST'.
    CALL METHOD http_client->REQUEST->SET_FORM_FIELD
    EXPORTING
    NAME = 'title'
    VALUE = 'Mail sistema'.
    CALL METHOD http_client->REQUEST->SET_FORM_FIELD
    EXPORTING
    NAME = 'details'
    VALUE = 'Funcion 1234'.
    CALL METHOD http_client->send
    EXCEPTIONS
    http_communication_failure = 1
    http_invalid_state         = 2.
    CALL METHOD http_client->receive
    EXCEPTIONS
    http_communication_failure = 1
    http_invalid_state         = 2
    http_processing_failed     = 3.
    CLEAR w_result .
    w_result = http_client->response->get_cdata( ).
    REFRESH result_tab .
    SPLIT w_result AT cl_abap_char_utilities=>cr_lf INTO TABLE
    result_tab .
    READ TABLE result_tab INTO r_str INDEX 2.

  • How can I get HTML source code of dynamic Web page ?

    Hi,
    I would like to write a program that can get HTML source code of some Web pages, but there are some dynamic Web pages that I can't do it with URL class. For example: http://www.europlex.ch/web/3schedule/showAll.jsp?context=schedule.
    Thank you very much for any solution.

    Thank you for your attention. I'm sorry because I could't describe it clearly. If you don't mind, please follow this step to understand my problem:
    In the browser, enter URL: http://www.europlex.ch/web/main.jsp?locale=_english
    Click on Schedule, you will see the page with Cinema name, Film, Time... I would like to write Java Program to get HTML code of only this Page (Not frame page).
    Do you have any idea ?
    Thanhks,

  • Html code(source code) for  a web page

    hi all
    i want to get the source code for a web page throgh
    my java program .please can you tell me how to do it.
    thanks

    give this a try.
    import java.awt.*;
    import javax.swing.*;
    import java.net.*;
    import java.io.*;
    public class JApplet1 extends JApplet
         public void init()
              getContentPane().setLayout(null);
              setSize(470,391);
              JButton1.setText("google.com");
              getContentPane().add(JButton1);
              JButton1.setBounds(12,12,120,24);
              getContentPane().add(JScrollPane1);
              JScrollPane1.setBounds(12,48,444,336);
              JScrollPane1.getViewport().add(JTextArea1);
              JTextArea1.setBounds(0,0,440,332);
              SymMouse aSymMouse = new SymMouse();
              JButton1.addMouseListener(aSymMouse);
         javax.swing.JButton JButton1 = new javax.swing.JButton();
         javax.swing.JScrollPane JScrollPane1 = new javax.swing.JScrollPane();
         javax.swing.JTextArea JTextArea1 = new javax.swing.JTextArea();
         class SymMouse extends java.awt.event.MouseAdapter
              public void mouseClicked(java.awt.event.MouseEvent event)
                   Object object = event.getSource();
                   if (object == JButton1)
                        JButton1_mouseClicked(event);
            URL u;
         URLConnection conn;
         InputStreamReader in;
         BufferedReader data;
         String line;
         StringBuffer buf = new StringBuffer();
         void JButton1_mouseClicked(java.awt.event.MouseEvent event)
             try{
                 u = new URL("http://www.google.com");
                  conn = u.openConnection();
                  in = new InputStreamReader(conn.getInputStream());
                  data = new BufferedReader(in);
                  while((line = data.readLine()) != null)
                      buf.append(line + "\n");
                  JTextArea1.setText(buf.toString());
              }catch(Exception e){}
    }

  • Dynamic-side Box? Can't read source code with java

    Hi all,
    I am trying to read a source code of a web page with a java program. I can connect to the page and read a part of the source code without any problems however after a while when it comes to a part where mozilla and opera identifies as "dynamic-side box" my java program fails to read the source code and stops reading the rest of the page.
    Here is the part of the output I get from mozilla:
    <body id="city">
              <script type="text/javascript" src="/js/wz_tooltip.js"></script>
              <div id="container">
                   <div id="container2">
                        <div id="header">
                             <h1>Ikariam</h1>
                             <h2>Antik �a&#287;&#305; Ya&#351;a!</h2>
                        </div>
    <div id="breadcrumbs"><h3>Bulundu&#287;un nokta:</h3><a href="?view=worldmap_iso&islandX=78&islandY=80" title="D�nya haritas&#305;na d�n"><img src="skin/layout/icon-world.gif" alt="D�nya" /></a> > <a href="?view=island&id=2444" class="island" title="Adaya d�n">Sterios[78:80]</a> > <span class="city">ProPolis</span></div><!-- -------------------------------------------------------------------------------------
         ///////////////////////////// dynamic side-boxes. //////////////////////////////////
         //////////////////////////////////////////////////////////////////////////////////// -->
         <div id="information" class="dynamic">
              <h3 class="header">Info</h3>
              <div class="content">And here is the corresponding part in java console output:
    <div id="breadcrumbs">
        <h3>Bulundu&#287;un nokta:</h3>
         <span class="textLabel">Hata!</span>
    </div>
    <div id="information" class="dynamic"></div>
    <div id="mainview">
        <div class="buildingDescription">
            <h1>Hata!</h1>
        </div>
        <div class="contentBox01h">
            <h3 class="header"><span class="textLabel">Hata mesaj&#305;</span></h3>
            <div class="content">
                <ul class="h�bsch">
    <li><a href="http://ikariam.net"></a></li>            </ul>
            </div><!-- end #content -->
            <div class="footer"></div>
        </div><!-- end #contentbox -->
    </div><!-- end #mainview -->Is there a way to skip this dynamic-side boxes in java. Because I need to read an information that is located at the near end of the source code however since it stops when it hits to a dynamic-side box I can't.
    Thanks in advance, regards...

    Hi,
    That is what I was trying in deed! I was trying with a Scanner but I also tried with the link you have given. That also failed. Somehow java stops reading the source when it hits "dynamic-side box". However there has to be a way to skip this. If mozilla can do that, I know that java also can. I wonder how....
    Cheers...

  • ABAP WD, Read the source code of a html page

    Hi all,
    I have the URL link of .jsp page and I want to get the source code generated by this page to extract some data for my web dynpro.
    How do i solve this?
    Thanks

    Hi Antonio,
    not sure if i understand the question properly.
    You want to read html content of http site rendered via jsp.
    You can use cl_http_client
    to write a simple http client tool.
    This tool opens the page.  The html content is available to this class.
    You can extract the content here.
    See the attribute 'response' after making a call.
    regards
    Phil.

  • How to Write source code of a html page to a File

    Using this code i could find the source code of a html page from a web server
    import java.io.*;
    import java.net.*;
    public class SourceViewer{
    public static void main (String[] args) throws IOException{
    System.out.print("Enter url of local for viewing html source code: ");
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String url = br.readLine();
    try{
    URL u = new URL(url);
    HttpURLConnection uc = (HttpURLConnection) u.openConnection();
    int code = uc.getResponseCode();
    String response = uc.getResponseMessage();
    System.out.println("HTTP/1.x " + code + " " + response);
    for(int j = 1; ; j++){
    String header = uc.getHeaderField(j);
    String key = uc.getHeaderFieldKey(j);
    if(header == null || key == null)
    break;
    System.out.println(uc.getHeaderFieldKey(j) + ": " + header);
    InputStream in = new BufferedInputStream(uc.getInputStream());
    Reader r = new InputStreamReader(in);
    int c;
    while((c = r.read()) != -1){
    System.out.print((char)c);
    catch(MalformedURLException ex){
    System.err.println(url + " is not a valid URL.");
    catch(IOException ie){
    System.out.println("Input/Output Error: " + ie.getMessage());
    Iam not much a expert in java .. i could find some commands to write to a file but i dont know where to use those codes , some body please give me some idea ..
    thanking you ..

    You're welcome. How about awarding them duke stars?
    edit: cheers!

  • How to get the source code of an HTML page in Text file Through J2EE

    How to get the source code of an HTML page in Text file Through J2EE?

    Huh? If you want something like your browser's "view source" command, simply use a URLConnection and read in the data from the URL in question. If the HTML page is instead locally on your machine, use a FileInputStream. There's no magic invovled either way.
    - Saish

  • How to get the source code of an HTML page in Text file Through java?

    How to get the source code of an HTML page in Text file Through java?
    I am coding an application.one module of that application is given below:
    The first part of the application is to connect our application to the existing HTML form.
    This module would make a connection with the HTML page. The HTML page contains the coding for the Form with various elements. The form may be a simple form with one or two fields or a complex one like the form for registering for a new Bank Account or new email account.
    The module will first connect through the HTML page and will fetch the HTML code into a Text File so that the code can be further processed.
    Could any body provide coding hint for that

    You're welcome. How about awarding them duke stars?
    edit: cheers!

  • How do I see the source code of a html page?

    In previous versions it was possible to read the source code on a html page from "view" menu. It is not longer there. How do I read code now?

    You're welcome

  • View the html source code of an apex page

    Hi everyone,
    I search to how I can view the html source code of an apex page and to be able to modify it. That's why viewing the html source code from the browser when the application is running doesn't arrange me.
    Has anyone an idea how it can this be possible?
    Best regards,

    Khadija Khalfallah wrote:
    Hi everyone,
    I search to how I can view the html source code of an apex page and to be able to modify it. That's why viewing the html source code from the browser when the application is running doesn't arrange me. What do you mean?
    Do you want to be able to pull up the HTML source generated by Apex, modify that copy, and then feed it back into Apex with the chagnes you made? If so you can't. Apex generates the HTML through its tools and you have to modify the generation routines to get different HTML.
    Do you merely want to look at the generated HTML? In Internet Explorer all you have to do is right click on the page and choose View Source to open a window with the HTML source in an editor. I sometimes find it useful to save a page and manually edit the copy to immediately see the effects of certain changes to the underlying HTML and/or Javascript without permanantly making the change in Apex.

  • I just purchased photoshop elements and went to retrieve my serial code.  The web page provided to retrieve it loads blank, even when clicking on the URL through adobe's web site.  I can not install my product without this.  Please help

    I just purchased photoshop elements and went to retrieve my serial code.  The web page provided to retrieve it loads blank, even when clicking on the URL through adobe's web site.  I can not install my product without this.  Please help

    Drusso77 if you are continuing to face difficulties locating your serial number then please see Find your serial number quickly - http://helpx.adobe.com/x-productkb/global/find-serial-number.html.  You are also welcome to contact our support team at http://adobe.ly/1aYjbSC.

  • Source code of a web browser

    Does any one knows how to get a example source code of a web browser?
    Or the source code of the HotJava browser???

    Hello,
    If you seeing a sample code. Please refer to java.sun.com's Java Tutorial
    Topic :: How to use JEditorPane.
    These Java Packages can help you.
    Javax.swing for JEditorPane
    javax.swing.text for Document class
    Javax.swing.event for HTML Listener(to open hyperlink and pictures)
    For a Complete Solution please go to any S/W Company and make your own browser.

  • Is there any way to read XML directly from a Web Page ??

    i have a url, which on sending request, shows XML in browser.
    Now i need to read this XML in browser and then manipulate it according to my need and display it on another page.
    actually the process is. :
    1) i have to first retrieve an xml from other site. (XML will only be shown in browser)
    2.)then i have to read the Xml and show it in according to my requirements.
    Is there any way to read XML directly from a Web Page ??
    is their logic to accomplish this.
    e.g in Servlet i can do somewhat like this :
    String wholeXml=Somemethod(url);
    Please Advice

    the average Java XML parser will accept an InputStream, so just open an URLConnection to the webpage, get the inputstream from it and feed that inputstream to the XML parser. If the URL has valid XML data, it will get parsed without problems.

  • How to read source code in Safari?

    How do I read a web page source code using Safari?
    Thanks.

    Safari > Preferences > Advanced > Show Develop in menu bar
    then
    Develop > Show Page Source

Maybe you are looking for

  • SQL query problem while combining two values.

    Hi, I am having a table test with columns X and Y. X is not nullable where as Y is nullable. I had a requirement where I have to get these two values seperated by '-' (Hyphen). So I wrote the query like : Select X||'-'|| Y from test. But now Y is nul

  • My iPod touch is not responding to anything...please help?

    Okay so a week ago I was listening to my ipod touch's app "iheartradio" (ipod touch is 8GB and 2nd generation). The battery was low, and it then died. Later on that night, I went to plug it into my wall charger, and it did not respond. Normally when

  • Synching/manual add to multiple iDevices with multiple computers.

    Okay, Here's the issue. I own an Iphone, and multiple versions of iPods (3 different Nano versions and an old Ipod Photo). I also own three PC's. One desktop, one laptop and one netbook. All run windows 7. Why is it that it is so bloody impossible to

  • Weird Kuler Extension Panels in PS and AI

    The Kuler panel on AI, "Unable to connect to the kuler website, The server is either busy or you are offline."   But it does work on INDD and PS I just can't see any of my saved color schemes I can only see the popular ones.  I have done research and

  • MY FF22 wont INSTALL.....I have tried everything but nothing happens.

    My daughters Laptop is running Vista OS. FF version 6. I went to update her browser... I downloaded from the green button got a binary file called setup stub. went to install.... PC asked if ok to run I sed yes but got NO install. ....Nothing....I we