Parsing Content From A Site That Requires Authentication

Ive been scanning websites using the Java HTML parser from htmlparser.sourceforge.net to gather useful data into a more easily used format, in this case it is stored in a mySQL database.
The problem that has stumped me for the past few days is how to get around the login authenication page required to access content from the website www.racingpost.com . I am a registered user but am having difficulty logging in via Java and managing the cookies to bypass the login page HTML I keep getting instead of the race data.
I am unsure when and where I should be passing cookies around. Also logging in using POST is confusing me.
Thanks for any help you can offer.

this should help you out with posting to a URL. It is taken from:
http://javaalmanac.com/egs/java.net/Post.html
// e135. Sending a POST Request Using a URL
    try {
        // Construct data
        String data = URLEncoder.encode("key1", "UTF-8") + "=" + URLEncoder.encode("value1", "UTF-8");
        data += "&" + URLEncoder.encode("key2", "UTF-8") + "=" + URLEncoder.encode("value2", "UTF-8");
        // Send data
        URL url = new URL("http://hostname:80/cgi");
        URLConnection conn = url.openConnection();
        conn.setDoOutput(true);
        OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
        wr.write(data);
        wr.flush();
        // Get the response
        BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String line;
        while ((line = rd.readLine()) != null) {
            // Process line...
        wr.close();
        rd.close();
    } catch (Exception e) {
    }

Similar Messages

  • I can't send mail to the site that required Authenticator

    How can I send mail to the smtp site that required Authenticator,If th smtp site doesn't require Authenticator ,I can send mail.
    My program:
    Properties props=new Properties();
    props.put("smtp","smtp.163.com");
    props.put("auth","true");
    MailUser mu=new MailUser("username","password");
    javax.mail.Session session=javax.mail.Session.getDefaultInstance(props,mu);
    public class MailUser extends Authenticator
    String username;
    String password;
    public MailUser(String us,String ps)
    this.username=us;
    this.password=ps;
    }

    Properties props = System.getProperties();
    props.put("mail.smtp.host", "hiart.co.kr");
    props.put("mail.smtp.auth","true");//auth module....
    session = Session.getDefaultInstance(props,null);
              Date date = new Date();
    msg = new MimeMessage(session);
              System.out.println(from);
    msg.setFrom(new InternetAddress(from+"@hiart.co.kr"));

  • I'm trying to log into my site that requires authentication but I get a popup that says it doesn't require authentication and then I get a 403

    I have a site that requires authentication. In the past i have logged in using firefox with the following format
    http://username:password@sitename:siteport/specificsiteurlinfo
    and gotten in just fine. I just set up a new computer with a new instance of firefox and try the same thing but I now get the following popup-
    "You are about to log in to the site "sitename" with the username "username", but the website does not require authentication. This may be an attempt to trick you.
    Is "sitename" the site you want to visit?"
    When I click "yes" Firefox appears to try to go to the site without any authentication and I of course get a 403 Forbidden error.
    I have tried reverting back to old versions of Firefox with no luck.
    Any advice would be greatly appreciated.
    Thank you.

    The purpose of that warning is to alert you to the possibility of being fooled by a link with login credentials at the beginning. On your old computer you might have tweaked this setting to limit when the warning appears:
    http://kb.mozillazine.org/Network.http.phishy-userpass-length
    This article discusses the steps to adjust that setting to fit your needs: [http://fix.lazyjeff.com/2011/04/disable-firefox-login-prompt.html].

  • I am trying to us a form on a site that requires authentication and it won't work with Muse

    I called the provider and they sent me a bunch of code to insert in order to make the form work but is there anyway I can make it work from within Muse? https://solutions.hostmysite.com/index.php?/Knowledgebase/Article/View/8460/0/using-pear-m ail-to-create-a-php-mail-form-that-uses-authenticationauthentication-is-required-by-hostmy site
    I have no idea how to deploy any of that stuff or how to do a captcha without using Muse. 
    The website is question is http://www.kiddintl.com/work-with-us.html
    Should I have the domain point to an adobe business catalyst site in order to make everything in Muse work correctly?
    [email protected]

    Hi Peter,
    In the latest release of Muse the option of recaptcha was added to both Bc and non Bc hosted site. Please check the link below to know more on this.
    http://helpx.adobe.com/muse/using/form-widgets.html#Preventing spam using Google reCAPTCHA
    I am afraid that this is not possible in Muse, to generate captcha for a site that is not hosted via Bc, at this stage, I will recommend that you post this on our ideas section over here, https://forums.adobe.com/community/muse/ideas, and let our devs team know of this requirement.
    In the meantime, you will need to insert the captcha code manually on the Muse form once after you have exported the html of the site and this is something that you will need to every time the code is generated because Muse will overwrite the changes that you have made.
    - Abhishek Maurya

  • How can I see content on web sites that require adobe flash player?

    We installed a web tv from our clinic but it requires adobe flash player, how can I see this stuff?

    Despite what has been said, there is no Flash player for iOS devices.
    http://www.apple.com/hotnews/thoughts-on-flash/
    There are some browsers like Skyfire that can play some Flash content, but performance varies so try different apps to see if any can display the sites you go to...but don't expect greatness.

  • Sites that require HTTP authorization

    All our dev sites are password protected, so all I get is error 401, not authorized.
    Any plans on adding the ability to provide login details so that protected servers can be checked to?
    /Erik

    With the recent release of Adobe BrowserLab for Firebug Addon for Firefox it is now possible to preview pages on sites that require authentication.
    You first setup Firefox with Firebug and BrowserLab for Firebug Addon:
    Install and run Firefox
    Install the Firebug addon for Firefox
    Install the BrowserLab for Firebug Addon
    Select Tools -> BrowserLab for Firebug -> Options
    Select “Allow read access” and press “OK”
    Once the setup is complete you just:
    Navigate to a site that requires authentication and enter your credentials
    Navigate within the site to the page you want to preview
    Select Tools -> Adobe BrowserLab for Firebug -> Preview Local Source
    When Preview Local Source is selected BrowserLab will tunnel files through Firefox rather than getting them directly from the web. This means that any page that you can navigate to in Firefox can be previewed by BrowserLab in any of the browsers it supports.
    You can get the BrowserLab for Firebug addon here: https://addons.mozilla.org/en-US/firefox/addon/231196/

  • I have a MacBook Pro and OS10.6 and am trying to log into a site that requires me to enter a code from a picture ... problem is all I get on the screen is a white '?' in a blue box. What do I need to display the picture?

    I have a MacBook Pro and OS10.6 and am trying to log into a site that requires me to enter a code from a picture ... problem is all I get on the screen is a white '?' in a blue box. What do I need to display the picture?

    Reload the page. If it doesn't load, choose Activity from Safari's Window menu, find that picture in the list, and see what it says to the right; this may reveal what the problem is.
    (91827)

  • How can I copy a photo from iphoto to PReview to make it smaller for uploading to a site that requires a smaller image?

    How can I copy a photo from iphoto to PReview to make it smaller for uploading to a site that requires a smaller image?

    I don't think you need Preview.
    Select the image and use File->export and you have full control over the size and compression.

  • How do I scrape external content using a URLScraper channel through a proxy that requires authentication?

    I need to scrape external content but my Portal Server lies in my Intranet. The company has a Proxy server that needs authentication in order to browse the Internet.
    In the gateway settings, I have made the entries:
    iplanet.com|
    * Proxyip:proxyport|
    This works in the sense that the gateway contacts the proxy for the content, but I get the Proxy Authentication failed page.
    Where do I pass my username and password?
    Regards,
    Vibha

    At the present time, you cannot use URLScraper with proxies that require authentication. You can either reconfigure the proxy to not require authentication when accessed by the portal, or create your own custom provider to pass proxy authentication information in the HTTP header.
    Stephen

  • How do I store passwords from sites that require logon ?

    How can I store passwords from sites that require them for logon ? In the Tools - Options menu, you can only delete or hide them, not add new ones.

    See also:
    http://kb.mozillazine.org/User_name_and_password_not_remembered (bookmarklet)
    http://kb.mozillazine.org/Password_Manager

  • How can I download content from this site

    How can I download content from this site:
    http://www.oxfordbusinessgroup.com/full_content/agriculture-67

    What kind of content is that (text, image, PDF)?<br />
    On that first page it is only an image (Tools > Page Info > Media)

  • Trying to veiw videos from a website that requires me to download firefox and silverlight.My imac osx 10.5.8 will now download firefox. firfx tells me my mac is not compatible with ffox Please help me ?  Thank you

    trying to veiw videos from a website that requires me to download firefox and silverlight.My imac osx 10.5.8 will now download firefox. firfx tells me my mac is not compatible with ffox Please help me ?  Thank you

    There is a version of Firefox 4 available for PPC Macs:
    TenFourFox 4.0.1 Firefox 4 For PowerPC Browser Released
    Version 4.0.1 of TenFour Fox, FloodGap's port of Firefox 4 for Power PC
    Macs that supports both Mac oS X 10.4 and 10.5. has been released.
    Mozilla.org dropped support for OS 10.5 after Firefox 3.6 and for Power
    PC with the fourth beta of Firefox 4.
    TenFourFox uses almost all the same code as Firefox 4 and has nearly all
    the same features, including faster JavaScript, WebM video, and HTML 5
    and CSS 3 support, as well as new and emerging Web features, but with
    the code needed to keep your Power Mac functional and fast. Out of beta
    and it's ready for action, versiob 4.0.1 is a performance, security and
    stability update incorporating Mozilla's Firefox 4.0.1 plus AltiVec acceler
    -ation for WebM and browser graphics, and G5 JavaScript acceleration.
    For more information, visit:
    http://www.floodgap.com/software/tenfourfox/
    Source: from http://www.applelinks.com - posted April 25, 2011)
    Now for the intersting bit: TenFourFox, like Firefox, does not support most plug-ins. Unless you are prone to headaches (in which case don't) you can read about that here:
    http://code.google.com/p/tenfourfox/wiki/PluginsNoLongerSupported
    But there is a workaround!
    Open TenFourFox and type in the address bar: about:config (no spaces) and click return. This gives you a warning that it might harm the application. Ignore that and click on 'I'll be careful, I promise' and you get the config file that you can edit - with great care.
    Look/search (scroll down) for: tenfourfox.plugins.enabled
    Set it to true. (Double click it to toggle it)
    Now close TenFourFox, open it again, and Flash will now work, as it now uses the plug-ins that Safari has stored.
    With SilverLight, Microsoft attempted to create their own version of what a replacement for Flash could be - but not to universal acclaim. You can read more about it here:
    http://silverlight.net/
    So, if you go to any sites that have been designed for this new Silverlight stuff, you can download the plug-in from here (but make certain that you are downloading SilverLight v.1.0 for OS X (10.4.8 upwards) if you are using a PPC Mac, but even this will not work with Safari 4. Version 2 only works with Intel Macs and does work with Safari 4/5. The solution is to download and install the latest version of Flip4Mac, which now includes a Silverlight component:
    http://dynamic.telestream.net/downloads/download-flip4macwmv.htm
    But the latest news is that Microsoft will probably abandon Silverlight in favour of HTML5:
    http://www.appleinsider.com/articles/10/10/29/apples_ios_pushes_microsoft_to_dia l_down_silverlight_for_html5.html  and
    http://www.bbc.co.uk/news/technology-11673384

  • With some (not all) sites that require passwords, how do I get Firefox to resume saving passwords when the site is not in the exception list?

    For some banking sites that require passwords, I am 99.3% sure I at some time said "never remember passwords." Now I want to change my mind. When I go to Options/Options/Security/Remember.../Exceptions, the sites are not listed, but I still am not asked the question 'Want to remember....'

    Thanks for your help and your quick reply, cor-el!
    I did install the view passwords bookmarklet; it worked properly. I installed the saved-password-editor, and I think I entered all fields correctly, although (1) I was not sure of the meaning of the field 'submit prefix' and used the 'guess from current page' button, and (2) I winged it using the default on both the username field name and the password field name because the guess button simply said 'fill this form based on a likely login form on the current page.' [Does the button pick up that name?]
    After fumbling a while, everything got to working! So, THANKS! Although I'm still not sure what the 'view passwords' bookmarklet does for me, since I do know the needed passwords.
    I'm going to leave this open for one more day, since as a first-time user I don't know whether messages are added (such as explanations to my above minor issues) after I acknowledge the problem solved. I'll do that tomorrow.

  • How to view sites that require adobe flash

    Here's one to get you all laughing at the rookie. Considering switching from my pcs to macs and was just wondering if there are ways to view sites that require adobe flash, I've heard that you can't as well as you can, but the downloads are really bad. Just looking for a solid answer. This being one of the many thoughts/apprehensions I have about switching to a whole new computer world. Thanks for the help, Mike

    Thank you both for the input, have to admit its a little daunting, thinking about changing from one os to another. But from what I've read and heard its really not that much of a hassle. Thanks again for the quick response' Mike

  • How to access sites that require flash

    How do I access sites that require Adobe flash player on the IPAD2?

    You can't without installing another browser that supports Flash from the App store.  Search the app store.
    Just keep in mind, that like Flash players for mobile devices, these apps are less than optimal.  This is why Flash is not supported on iOS devices by Apple.

Maybe you are looking for