Read web page content via Sockets

Hey,
I have to write a program that will read web page content, using sockets.
I got that piece of code and it works for most pages:
Socket socket = new Socket(address, 80);
          BufferedReader input =
               new BufferedReader(
                    new InputStreamReader(socket.getInputStream()));
          PrintWriter output =
               new PrintWriter(socket.getOutputStream(), true);
          output.println("GET " + pageName);
          String response = "";
          String curline  = input.readLine();
          int i=1;
          while(curline != null){
             response += "\n" + curline;
               curline   = input.readLine();
               System.out.println(i + curline);
               ++i;
          output.close();
          input.close();but not for the one it is supposed to work:
http://portalwiedzy.onet.pl/tlumacz.html
I could get it to work using this:
URL url = new URL(host + query);
URLConnection uc = url.openConnection();but I really have to use sockets.
Any advice, people? :-)

There's an RFC that goes over the HTTP protocol (or rather, several RFCs for the several versions of the protocol). You probably want to google for that and use it as a reference for this project.

Similar Messages

  • How to manage web page content via labview

    My pproblem is to get cyclic information from a web page containing an
    applet.
    Using a container I cannot manage any text and object in the page. Isn't it?
    Ciao

    If I understand you correctly, you are hosting a webpage in a front panel ActiveX container, and you want to obtain certain information from the webpage.
    This is possible using ActiveX calls. To get access to the HTML document in the container itself, along with all of its text and applets, etc, you need to reference the Document child item from a property node. This item is variant, so you need to use Variant to Data with a ActiveX refnum constant set to MSHTML.IHTMLDocument2 wired to the type. At that point you can access information about the HTML page itself, such as the body's text and so forth.
    I'm attaching a simple example that should help you get started. It's written in LabVIEW 7.1. Good luck!
    Jarrod S.
    National Instruments
    Attachments:
    HTML Document Info.vi ‏36 KB

  • Downloading web page content

    I want to take radio programme listings from a web page, such that I can parse the data and select certain programmes details only.
    Firstly how do I actually get the web page content out? Does it go into a text file? The actual content includes programme times, which might be a means of picking out selected text. Does anyone know where I could find some code that will do that. My intention is to pass this information into a database which connects to my own web site.
    This is for a dissertation and I am starting to run out of time, so I would be hugely grateful for any assistance.
    Thanks
    Rob

    Looks like you need to...
    a. Read Javadoc for java.net.URL
    b. Read about JDBC(if what I understood is right, which is output of your program goes to database) See http://java.sun.com/products/jdbc/index.html
    c. Read about XML parsing and transformations. See http://java.sun.com/xml/xml_jaxp.html

  • Centre Align Web Page Content

    Hi,
    Need some help center aligning web page content when it maximizes or is resized. I have grids, panels, etc and want these to center on page.
    Is there a property of the page/body/head/form/div that can be set for this or is javascript required to achieve this.
    Any help mcuh appreciated.
    SNI

    Hi,
    I tried what the thread did and still cannot my layout panel to center align.
    This is my jsp line:
    <ui:panelLayout binding="#{Login.pnlLogin}" id="pnlLogin" style="height: 306px; left: 382px; top: 216px; text-align: left; vertical-align: middle; width: 100%; -rave-layout: grid; horizontal-align: left;">

  • Analysis of the Web Page Content

    Could anyone give me some tips on it?3x

    Can you expound on what you need ie what WEB PAGE CONTENT?

  • Printing web page content from android tablet

    When I attempt to eprint a web page, the web address line prints just fine (with a lower line that reads:"sent from Samsung tablet"), but none of the content, even though the print preview showed everything on the page that I needed. PLEASE HELP!   Is the web page content considered an attachment and if so, how do I get the attachment to print?
    This question was solved.
    View Solution.

    Hi TurboLady,
    Thank you for the update.  I appreciate it.  You read the document correctly.
    The best way to print the web content is to print the web page using the browser found in the HP ePrint app.  Please download and install the HP ePrint Mobile app from the Google Play store. For reference I’ve included the HP ePrint Mobile App FAQ document.
    Please let me know how that works for you.
    Regards,
    Happytohelp01
    Please click on the Thumbs Up on the right to say “Thanks” for helping!
    Please click “Accept as Solution ” on the post that solves your issue to help others find the solution.
    I work on behalf of HP

  • Reading web pages through forms

    Hi all there,
    I am using forms6i, I am having few html pages, now i want to read contents of those pages and feed them into a form item. can any body give me an idea how it can be done?
    thanks in advance

    This looks like a job for utl_http.
    DECLARE
      req   UTL_HTTP.REQ;
      resp  UTL_HTTP.RESP;
      value VARCHAR2(1024);
    BEGIN
      req := UTL_HTTP.BEGIN_REQUEST(
        'Reading web pages through forms
      UTL_HTTP.SET_HEADER(req, 'User-Agent', 'Mozilla/4.0');
      resp := UTL_HTTP.GET_RESPONSE(req);
      LOOP
        UTL_HTTP.READ_LINE(resp, value, TRUE);
        DBMS_OUTPUT.PUT_LINE(value);
      END LOOP;
      UTL_HTTP.END_RESPONSE(resp);
    EXCEPTION
      WHEN UTL_HTTP.END_OF_BODY THEN
        UTL_HTTP.END_RESPONSE(resp);
    END;
    /

  • Safari web page sent via apple mail to entourage - block submission

    .. at this point, I'm just wondering what it is about a web page sent via Apple Mail (great feature!) which causes Entourage to display the warning "For your security, Entourage will block submission of this form"? ..
    .. in particular, what are the file types in this kind of message via Apple Mail which need to be "allowed" in the Entourage Attachment Policy .plist? ..
    .. a side note - even the microsoft entourage support webpage dealing with this issue sent via Apple Mail was blocked! ..

    You're suffering from two common misconceptions.
    1. You will never get a response from Apple when you submit a crash report. The reports are used internally, if at all.
    2. This is not Apple tech support. This is a forum provided by Apple for users of its products to discuss technical issues among themselves. No one here represents Apple or knows anything about your contacts with Apple. If you want support from Apple, click the Support link at the top of this page.

  • How can I add a "search" field for web pages content-not blogs or podcasts?

    This seems to be such a basic function, I can't believe I'm having so much trouble. I don't have a blog or a podcast on my new website that I'm in the process of designing. So how do I allow people who'll visit my site to search there for specified content? The only instructions I find are for the RSS in inspector for blogs or podcasts. All I want is for people to be able to search my site/web pages (that have no blogs or podcasts on them). This must be a common request... or am I crazy? How do I do that?
    Thanks for your help.

    I think I've answered my own question after a few hours of searching:
    http://services.google.com/searchcode2.html?accept=on
    Thank you Google.

  • Web page content on 11.6 Air often displays incorrectly.

    I love my Macbook Air 11.6 for its quality size and weight but web browsing is a pain. I would love to read an open discussion on this. It seems to be that because the screen ratio is unusual i.e. very 'wide screen', many web pages are not written so that they display correctly. One has to always zoom in at least twice, but I could live with that if the content all displayed correctly, but it often doesn't. Try going to the BBC.co.uk. First page is ok but click on Wimbledon live and the links to live games are a mess. Try KLM.com - one has to zoom until it goes off the right hand side before the booking fields display correctly. Same thing for Cricinfo.com.
    Today, I see that Chrome does it better but shouldn't Safari (my preference because of how it handles Evernote) be the KIng on Macs? Will this ever be rezolved? In Apple stores the genius says that it is down to the coding done by the web site writers and so I fear that they are not going to all re-write their code to please just one weird screen aspect ratio.
    My best solution would be to sell this and get a 13.3, no? Pity but seems the only way...   JJ

    Actually, 1366x768 is a very common resolution (and has been for quite a few years).  It really is up to the website coding and the browser to deal properly with different resolutions.  You should be able to even select an actual odd resolution manually and have the page display correctly.  But, with respect to the resolution of your Air, it is basically an industry standard and should not be the cause of any problems with the way a site displays.

  • Web page content missing in Safari

    When viewing a web page in Safari several drop down links are missing. (As compared to viewing in Explorer).  How do I get them to appear in Safari as they are crucial to the navigation of the site?

    I agree.  Looks like Safari doesn't work here.  You can report this to Apple via the Safari > Report Bugs to Apple menu item.
    I tested this page with Firefox and it works properly.

  • My Yahoo like Dynamic web page content creation

    Are there any methodologies/best practices available for creation of pages like My Yahoo.
    Basically, display of page depends on sections chosen by the user for display and inside those sections content is also what is chosen by the user. Page is different for different users based on their options.
    Are there any methodologies/best practices available for this kind of work using JSP.

    If your ISP don't support JSP / Servlets,
    1.use any server side technolgy, something like ASP.
    2.Read the files and transform them as Strings (or StringBuffers).
    3.Pass these Strings as parameters to the applet (if you are forced to use java technology, otherwise you can do it using ASP itself).
    4.Construct the required format (content) in your applet.
    Don't forget that the stuff will be in applet but not a complete web page. The ideal solution is asking your ISP to provide JSP engine.

  • Using Java for dynamic web page content

    I've currently got a Perl program that I'd like to convert to Java. It merges two files that are stored on a web server and generates a "dynamic" HTML response.
    For example, if I have the following files on the server:
    File1:
    <Comment1>This stuff</Comment1>
    <Comment2>That stuff</Comment2>
    File2:
    <HTML>
    <Comment1><br><Comment2>
    </HTML>
    When I go to the URL
    www.mysite.com\cgibin\merge.pl?file1&file2
    the Perl program will produce a web page saying:
    This stuff
    That stuff
    The major obstical for the rewrite: NO JSP ALLOWED. It's not allowed by the ISP.
    Now for the questions:
    - Could this be done using Java?
    - How could I initiate the Java app and pass it the parameters? (applet tag, access Java inside Perl, use Java Script somehow)
    - Will an applet tag even work for this since the final page is generated completely from other files?
    Thank you very much for your help.

    If your ISP don't support JSP / Servlets,
    1.use any server side technolgy, something like ASP.
    2.Read the files and transform them as Strings (or StringBuffers).
    3.Pass these Strings as parameters to the applet (if you are forced to use java technology, otherwise you can do it using ASP itself).
    4.Construct the required format (content) in your applet.
    Don't forget that the stuff will be in applet but not a complete web page. The ideal solution is asking your ISP to provide JSP engine.

  • Mail won't send web page content or link

    I posted this the other day on the Safari site but should have posted here as well.
    Suddenly I am unable to forward a web page in Safari 3.12 through Mail. I get the message:
    "Safari couldn’t create an email message because it couldn’t locate an email application.
    You can use the Mail application included with Mac OS X to send email. To do so, you might need to install Mail using the Mac OS X installation CDs."
    This occurs whether I wish to mail the link to the page or the page contents. The program has been installed since I purchased the laptop and never had a problem doing this before. Any ideas or solutions? Thanks,
    Dennis

    Found Answer in previous discussion of this date.

  • Simulate frames by loading web page content into DIV

    Hi, does anyone know if there is a way to simulate frames
    using CSS. Essentially, I want to load the content from another web
    page into a specific DIV. The content is from another web site, we
    have permission to use it, but I want it to appear within a page on
    my site that still has my navigation and header DIVs. So I want to
    load a new page into a content DIV, as if it were a frame. Can this
    be done? Thanks, JD

    By the way, IFrames have the same problems as frames....
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "bregent" <[email protected]> wrote in
    message
    news:e1umgn$227$[email protected]..
    > >The content is from another web site
    >
    > If you are well versed in server side scripting, you
    could do this without
    > a
    > (i)frame. Otherwise, you'll have to use some sort of
    frame. Of, find out
    > if the
    > other site can provide you with an xml feed of some
    sort.
    >

Maybe you are looking for

  • How to Maintain the Pricing Condition Records in CRM

    Hi I am new to the CRM How to maintain the pricing condition records in crm for the particular condition type? as we do in SD(VK11) Thanks

  • Ibook won't boot, after having DVD stuck

    I had a problem ejecting a DVD, as it had crashed. So after restarting, the grey screen appears with the apple, and the laptop did not come back on. I managed to eject the CD by holding the trackpad button, but OS X is still not loading. Any idea's w

  • Batch Processing Insertion(Avoids Integrity Constraint Rejection)

    Hi! To all of you. I'm new in this community. I've a question - hope you people can resolve my problem. How to insert data from one table to other? Suppose i've two tables say A And B. I want to insert data from A to B. In Table B, there is a constra

  • Updating to iOS 5 causes all mail on POP account to be downloaded again

    After updating to iOS 5 my phone decided to download all the messages off of my POP email accounts again.  I had set it up so that it would leave the messages on the server so I had thousands of messages stored there, but after the iOS 5 update it de

  • Unable to view my purchased moves within my Mac

    I am unable to view my purchased movies within my macbook pro laptop iTunes.  Yet, I am see them on my desktop's iTunes; what am I doing wrong here?  My iTunes on my laptop shows that I am signed on so there everything should be seamless? Please help