I hope someone can help me out on this one. I have been trying this for a while now, with all sorts of variations and cannot seem to get this to work.

I am trying to script a way to log in to https://login.three.ie/ to check account balance from */My_account_balance

I have tried all sorts of wget commands but from what I read, curl is more likely able to accomplish this task..

I have been trying variations I came across online, including from here on stackoverflow but nothing seems to work.

Here is the last one I tried:

    curl -X POST -c cookies.txt -u "Uern@me:P@ssw0rd" https://login.three.ie/

This does save the cookies file here:

    $ cat cookies.txt

    Netscape HTTP Cookie File

    This file was generated by libcurl! Edit at your own risk.
    HttpOnly_login.three.ie        FALSE   /       FALSE   1433988274
    laravel_session eyJpdiI6IkFZWmxvZ2oyXC9NNGVIbHVpejZwRWp3PT0iLCJ2YWx1ZSI6Imxkd25UKzBoMldiQlhYZVJnVUpuNUVsblZ1cGJYZWcwM2E1bTtIWHRiQ2pwV0VwemJ4NFlYcDlzTndSeFRNanpwdDhMMTIrS2RGZGdGd0RNZU1yREJ3PT0iLCJtYWMiOiI0NWUwYzc1TY4ODI3ZmY3ODY5NjliODkxODMyODIzMjQwNmNkNjljNTE2NzQxNmQ4MzhhNDljNTdjM2QwZGY1In0%3D

But when I try to re-use the cookie, it looks like there is a redirect or something, as this is what I get:

    $ curl -b cookies.txt  https://my3account.three.ie/My_account_balance
    <html><head><title>302 Moved Temporarily</title></head>
    <body bgcolor="#FFFFFF">
    <p>This document you requested has moved temporarily.</p>
    <p>It's now at <a href="https://sso.three.ie/mylogin//login?auth-        

I don't understand what's happening here. Does anyone have an idea of what's going wrong, or even better, how to remedy this?


  • 3
    The curl switch -u is for basic authentication, where that login page is form based and you should be posting Form data with the -F switch. - on a side note the Chrome web developer toolkit network tab has an automatic save web request as curl command option.
    – HBruijn
    Jun 11, 2015 at 4:43
  • You can take a look into the excellent curl book how to use post with forms. ec.haxx.se/http-post.html and ec.haxx.se/http-cookies.html I assume you want the -c and -b flag.
    – Aleksandar
    Aug 19, 2017 at 12:56

2 Answers 2


It is possible that their website is authenticating the session stored in the cookies by redirecting them first to the login page. Then their login page will redirect back to the appropriate page as set during their redirection as the "service" parameter.

Curl does not follow redirects by default. Override this using the -L option:

$ curl -L -b cookies.txt https://my3account.three.ie/My_account_balance



You can use the -L option for curl to have it follow redirects.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .