Can I log in a site only with HttpUrlConnection?

I'm trying to write a small program which help me to log into my Megaupload account and manage my own stuffs there. But I met a obstacle right from the start, login site.
After reading some of Sun's ["working with URLs" lesson|http://java.sun.com/docs/books/tutorial/networking/urls/index.html] and searching around, I've tried coding a small method to do this step. As the following:
try{
       URL mega = new URL("http://megaupload.com/?c=login");
       String data = URLEncoder.encode("login=1&
                                                        redir=1&
                                                        username=my_username&
                                                         password=my_password","UTF-8");
        HttpURLConnection connection = (HttpURLConnection)mega.openConnection();
        connection.setRequestMethod("POST");
        connection.setRequestProperty("Host", "megaupload.com");
     connection.setRequestProperty("Cookie", cookie);
     connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)");
     connection.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
        connection.setRequestProperty("Accept-Language", "en-us, en;q=0.5");
     connection.setRequestProperty("Accept-Encoding", "gzip,deflate");
     connection.setRequestProperty("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
     connection.setRequestProperty("Keep-Alive", "115");
        connection.setRequestProperty("Connection", "keep-alive");
     connection.setRequestProperty("Referer", "http://megaupload.com/?c=login");
     connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
     connection.setReadTimeout(10000);
     connection.setRequestProperty("Content-Length", Integer.toString(data.getBytes().length));
     connection.setDoInput(true);
     connection.setDoOutput(true);
        DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
     wr.writeBytes(data);
     wr.flush();
     wr.close();
       //Codes to reading the response from MU
}catch(Exception e){
}The headers i receipt was exactly the same as using Firefox, but the html body was always of the login site instead of redirecting to the home page with logged in status. After some failed attempts to solve it myself, I came up searching help from this forum, and realized that there's lots of problem similar to mine. However, not any of them is absolutely solved without using external libraries (HttpsClient). I wonder if I can do it only with existing internal libraries. If yes, what I need to do?
Thanks in advanced for help, and sorry for my bad English.

I modified it:
String data  = URLEncoder.encode("login", "UTF-8") + "=" + URLEncoder.encode("1", "UTF-8");
data  += "&" + URLEncoder.encode("redir", "UTF-8") + "=" + URLEncoder.encode("1", "UTF-8");
data  += "&" + URLEncoder.encode("username", "UTF-8") + "=" + URLEncoder.encode("chihuongbk", "UTF-8");
data  += "&" + URLEncoder.encode("password", "UTF-8") + "=" + URLEncoder.encode("19881026h", "UTF-8");
..........Got the same result. I think that's not the problem. I feel there is something missing. Can you tell me whether I can log in the site this way with some more modifications !??

Similar Messages

  • Hi there not sure what I did wrong but got a message asking if I would allow the application config but was warned by commputer not to now I can't log into some sites and others won't load properly, anyone had this problem and has advice?

    Hi there not sure what I did wrong but got a message asking if I would allow the application config but was warned by commputer not to now I can't log into some sites and others won't load properly, some sites will log in but only if the stay logged in box is not checked,I'v have cleared my cashe and internet history looked through securtity setting but nothing, anyone had this problem and has any advice?

    See KB Article:  http://support.apple.com/kb/HT1274 Changing or resetting an account password
    my current country does not have a apple store....
    AS are not the only places that repair Macs.  Check out the following:
    International AASP’s & Other Services
    AASP's Outside of the USA
    How to find your nearest Apple Authorized Service Provider (AASP)
    Also, there are User Groups that can possible help.

  • Can i import a old site create with leopard in iWeb on Lion?

    can i import a old site create with iWeb on leopard in iWeb on Lion intalled in another Mac?

    Yes you can but there are a couple of things you need to know. See this page under "iWeb and Lion OS X 10.7"...
    http://www.iwebformusicians.com/iWeb/iWeb-Tips.html

  • Can I log outside dynamic IP address with 871?

    I'm looking to clean up some web traffic analysis on a remote server. Can I log the changing outside dynamic IP my router is assigned to?

    You can always count on Ivan to have the details. I was unaware that the DHCP log only occurred on initial assignment.
    If you do decide to use an EEM applet, you don't need to do anything really special with the logging. Just turn it on in the configuration with "logging buffered 262144" (I use a 256KB logging buffer because the default is too small to be useful.)
    Another angle to take that might be easier is to use the DDNS functionality of the router with a service like Dyn. This way you always have a hostname you can reference with the current address and can see the history on their web site. This can be configured as follows:
    ip ddns update method DDNS_Dyn
    HTTP
    add http://username:[email protected]/nic/update?hostname=<h>&myip=<a>
    interval maximum 90 0 0 0
    interface GigabitEthernet0/9
    ip ddns update hostname example.dyndns.com
    ip ddns update DDNS_Dyn

  • Why can I log into some sites or view them correctly in Safari

    I have tried a few times to view the weather web site for one of my local stations, KOMO news. I can view this easily on my desktop computer, but a different version of the web page/site comes up on my IPod that does not have the same info, and there is no way of getting to the info I want to view (the 7-day forecast). What is this? And is there a way I can override what I'm seeing to view the web page I want to see? 
    Also, last night I tried logging into a few sites -- my web mail and utility bill pay -- with username and password, and instead of logging me in, the pages would keep "reverting" back to blank fields that I'd try again, and again (not even showing an error message, which is usually what I get if I enter wrong info.). It never worked, though it did work this morning from my desktop computer. Why won't Safari/Ipod let me log onto these sites?
    Regards, David

    Thanks for the advice everyone.
    Working through them without much luck...
    New user didn't help.
    Have turned off MacScan.
    No improvement as yet.
    P.S. Not sure how MacScan and Virus Barrier X would interact as they seem to do different things... I got both of these as apps in bundles so didnt really specifically buy them.
    I can't see any proxy setting in network preferences so will need to go into virus barrier and check.
    Reading the "recommended text" on Virus's for homework.
    Tomorrow it will be Appzapper for them both if the patient shows no sign of improvement.

  • Can browse the internet, but can't log in to sites such as ebay/play/yahoo

    Using either my Powerbook, or a friends MacBook, at his home using a 2WIRE wirelessly, or with ethernet cables, we can successfully browse any websites but as soon as we try to log in to sites requiring data from the Macs (passwords ect) the Mac's freeze on the pages as we try and log in.
    As data seems to flow into the Macs no problem, it's my guess something is going wrong as the Mac's try to send data back out through the 2WIRE to websites requiring user names and passwords. Any ideas what to do?

    Hi D P T!
    You could completely reset Safari.
    The instructions are for Tiger 10.4.x, as I have not installed my Leopard 10.5.x upgrade, but the process may be the same.
    If some of what I posted is significantly different, or nonexistent in Leopard, post that info before proceeding.
    To Reset Safari:
    Load Safari.
    From the Safari contextual menu, select Empty Cache
    From the Safari contextual menu, select Reset Safari.
    Check all options and click Reset.
    When that has completed, quit Safari.
    Navigate to HD > Users > Your Account > Library > Preferences:
    In that folder, locate and move to the Trash, this file com.apple.Safari.plist, and if present, com.apple.Safari.plist.saved.
    Navigate to HD > Users > Your Account > Library > Safari.
    In that folder, move to the Trash all items except Bookmarks.plist.
    Navigate to HD > Users > Your Account > Library > Caches > Safari.
    In that folder, move to the Trash, any items that appear.
    Empty the Trash.
    ali b

  • Can't log into web sites on iPhone 4s.

    I recently upgraded from an iPhone 3Gs to an iPhone 4s running iOS 5.0.1.  I've recently noticed that on the iPhone, I can't log onto any web site that requires my ID and password.  Basically the information is not recognized by the web site.  I had no problem logging onto these same sites on the old 3Gs. I've checked that the IDs and passwords are being entered correctly.
    If I use my iPad of my MacBook Pro, I can log onto theses same web sites without a problem.  I've tried resetting the iPhone but that has not fixed the problem.
    The log in problem only happens on the iPhone.
    Web sites that don't require an ID and password seem to be working fine on the iPhone.
    Has anyone else run across this issue?  Any ideas how to correct it?
    Regards,
    David

    Many web sites requiring username/password use cookies during authentication.  Be sure Settings | Safari | Accept Cookies is set to something other than Never.  I recommend From visited.  I think iOS 5 defaults this setting to Never, a difference from prior iOS versions.

  • Can someone show me a site made with BC en CC

    Hi I want to see some examples from sites made with business catalyst.
    And can you give me feedback if it is working well?
    Thanks for your reply!
    Carla

    The Business Catalyst website contains several examples of the kinds of websites that can be created using Business Catalyst: Cellar Thief, and Bella Vista Gifts.
    It's also important to note that Business Catalyst doesn't have to function as a "creation" tool as the above examples show, but instead can be a host for websites created using other Adobe tools, including Dreamweaver and Muse. The Muse tutorials page links to several examples pages, that were created entirely without coding.
    I'm in the process of building a personal portfolio website using only Adobe Muse and hosting via BC. The great thing about using BC with my Creative Cloud membership is that I can test as many versions of my website as I need before publishing anything. I'm personally having a great experience using Creative Cloud and Business Catalyst.
    Cheers!

  • I can't log in on my Ipad, with a correct Adobe-id

    I've tried to log in on my Ipad. To do so I've created an Adobe-id and I received a mail to verify, wich I did. I can now log in and out on the internet. If I try to do so on my Ipad, it tells me that the Adobe-id isn't correct.

    Hi BeksBWi,
    It looks like you have created your Adobe id on Adobe.com, which does not ask for date of birth. But, this information is required when you access acrobat.com on the web or the mobile device. When you use that Adobe id to login to https://files.acrobat.com, you will be prompted to enter the date of birth.
    Once you have entered the date of birth, you will be presented with terms of use. Please accept the terms of use and you will now be able to access the service on the web browser.Once your configuration on files.acrobat.com is complete, you can access the service on your mobile device as well.
    Let us know if you still face any difficulties with sign in to Acrobat.com.
    Thanks
    -Satyadev

  • I can't log into my main account with my password, always gets me back to the log-in screen after upgrading to 10.7.5

    After my routine software update to 10.7.5, I can't log into my main log-in id. Whenever I put my password in, it takes me back to the log-in screen. I'm sure of the password not being wrong because i can access my other admin accounts from which i changed the password. All my files and data is in that id. Please help. Thank you.

    http://osxdaily.com/2011/08/24/reset-mac-os-x-10-7-lion-password/ and
    http://osxdaily.com/2011/09/19/change-password-mac-os-x-10-7-lion-without-knowin g-current-password/

  • I am trying to log into a website "Northern Carping" which until I installed Firefox I could log into with no problems and I can still log into this site on my laptop (which doesn't have Firefox)???

    I am a member of a forum www.northerncarping.co.uk/ in which I am experiencing problems trying to log in since I installed FireFox. I also have a laptop which I don't use FireFox on and have no problems. Could it be something to do with firefox?

    Check the date and time in the clock on your computer: (double) click the clock icon on the Windows Taskbar.
    * https://support.mozilla.com/kb/Secure+Connection+Failed
    You can retrieve the certificate and check who issued the certificate and other details like when it is valid.
    * Click the link at the bottom of the error page: "I Understand the Risks"
    Let Firefox retrieve the certificate: "Add Exception" -> "Get Certificate".
    * Click the "View..." button to inspect the certificate and check who is the issuer.

  • I have an adobe ID but can't log in on Digital Editions with it. Only allow my 3M login to show

    I've been trying to authorize my devices on Digital Editions but it won't allow me to use my Adobe Log In - will only show my 3M Cloud Library information. How can I get the Adobe ID back? I've uninstalled and reinstalled DE many times and I feel like I'm running in a circle

    In order to change your Apple ID or password for your iCloud account on your iOS device, you need to delete the account from your iOS device first, then add it back using your updated details. (Settings > iCloud, scroll down and hit "Delete Account")

  • Can't log in to yahoo groups with NEO via hughesnet satellite, but can on other dsl-help!

    Problem is new-just started ~2 wks ago-no changes to my platform.
    Get "the connection was reset" message only when trying to log in to yahoo groups NEO version via hughesnet satellite (not gen4!)-problem not present via at&t/yahoo dsl log in.
    Can log into non NEO version of yahoo groups on same satellite without any problem-note: "https" not present in URL that functions fine.
    Same issue occurs with all 4 of my machines, win7 64bit and xp 32 bit. (All with latest sp's.)
    All machines updated to latest firefox and java plug in (#U51), cookies and cache dumped, every possible network access to internet setting tried, tried disabling add-ons (firefox run in safe mode tried)-everything!
    No change....and zero problem on anything else.
    The issue is NEO on satellite, without doubt-but how to work around this latest of yahoo lunacy?
    Thank you for any help!

    Thanks anotheroz....but:
    Such is not the case for me.
    I AM a moderator of only one group.
    When I joined myself to said group at another e-mail address, I found I had the old yahoo group layout (hurray!).
    I then used a dsl line with my original group owner account to set that "new" member up as a moderator-and it all worked fine from that new account via satellite.....'''UNTIL TODAY when yahoo scrubbed the old layout and forced that account into NEO.'''
    As soon as NEO is forced-'no more group access ability via satellite'....and I get this (again):
    "The connection was reset
    The connection to the server was reset while the page was loading.
    The site could be temporarily unavailable or too busy. Try again in a few moments.
    If you are unable to load any pages, check your computer's network connection.
    If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web."
    The problem is clearly NEO via satellite....question is-how to fix it?
    How can I reset the timeout function?
    Oy.....yahoo is just the worst!

  • Can't log into The Cloud Wifi with Retina Macbook Pro

    Hi there,
    I've researched this extensively online but haven't found a solution so far.
    Usually, when logging into The Cloud on my iPad Air or iPhone 4S at locations like Caffe Nero, I have no problem connecting: I connect in the device's settings, and then when opening the browser, reach the The Cloud landing page which lets me log on and properly use the Wifi.
    The other day I tried doing this with my brand-spanking-new Macbook Pro with Retina (mid-2014), and the landing page just wouldn't show up. So I couldn't log on; internet-enabled apps weren't working and I only had very limited access to Google. I tried both Safari and Chrome and refreshed multiple times.
    If anyone has any ideas, I'd hugely appreciate it! Thanks!

    Hi there.
    I can't help you unfortunately, but I have exactly the same problem. My macbook air mid 2012 used to connect to the Cloud wifi, like my iPhone 5 and iPad 2 still do no problem via the login landing page, but now though the bar at the top of my screen shows me connected, I don't get taken to the landing page (and I can't get there by manually feeding its address in either) and hence can't connect to the internet.
    If you do get a resolution I'd obviously be very interested.
    Sorry I can't help, but you're not alone with this problem.

  • Can't make the Telegraph site work with 25.0.1

    Often, when you issue a new release, The Telegraph website fails in Firefox and I have to use IE for a few weeks.
    But since 22.0 on 3 July, each time one follows a link, the text of the page is entirely blank.
    25.0.1 fails to fix this problem.
    I suspect that it has to do with The Telegraph's authentication that the user (ie me) has in fact paid for the rights to view.
    Curiously, there is never a problem with The Times, which operates a similar authentication scheme.
    I would have thought that there must be hundreds of thousands of Telegraph readers who are being forced to use IE (with all its vulnerabilities).
    Grateful for any ideas you may have.
    Best wishes and thanks for a super product
    René Milward, a firm Firefox believer

    You can try these steps in case of issues with web pages:
    Reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.
    *Hold down the Shift key and left-click the Reload button
    *Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    *Press "Command + Shift + R" (Mac)
    Clear the cache and cookies only from websites that cause problems.
    "Clear the Cache":
    *Firefox/Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Firefox/Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe Mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

Maybe you are looking for