Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Handling Cookies and redirects. the right way!?
Forum Updated to NodeBB v4.3 + New Features

Handling Cookies and redirects. the right way!?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 6.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shadyabhi
    wrote on last edited by
    #1

    Basically, I want to automate a task of logging in (by doing POST) to a website & doing another POST.

    Doing the 2nd POST requires cookies which were sent to me when I did login to the site.

    After doing login to the site, I am also get redirected to pages, so I want to handle that too.

    THe time I make the second POST to the server, I want to send the cookies which were sent to me earlier while logging in.

    I have tried doing this but was unsuccessful. Here is "my post regarding that effort":http://stackoverflow.com/questions/4509441/qt-http-post-issue-when-server-requires-cookies.

    I posted in other places too but could get a reply of which I could get real benefit. So, I decided for fresh start..

    Please spend a moment to see how I accomplished this "task very easily in python":http://linux-junky.blogspot.com/2010/03/python-script-for-sending-free-sms-in.html
    Guide me on how do I accomplish this task.. I have a hobby app on hold due to this. I really want to know how do I do that in C++ Qt.

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qtrahul
      wrote on last edited by
      #2

      The similar code example is given here :"how to handle an HTTP redirect with QNetworkAccessManager.":http://wiki.forum.nokia.com/index.php/CS001432_-_Handling_an_HTTP_redirect_with_QNetworkAccessManager

      Which may be help you.

      Generally, Login page requires the servers confirmation regarding automatic login.

      Best regards,

      1 Reply Last reply
      0
      • S Offline
        S Offline
        shadyabhi
        wrote on last edited by
        #3

        Thanks for your input. But, if you would checked all details of post, I have already tried that. See stackoverflow link.. I am having issue on how to handle cookies..
        Does making another call through QNetworkAccountManager wipes out the content of cookiejar which existed earlier?
        [quote author="qtrahul" date="1293090661"]The similar code example is given here :"how to handle an HTTP redirect with QNetworkAccessManager.":http://wiki.forum.nokia.com/index.php/CS001432_-_Handling_an_HTTP_redirect_with_QNetworkAccessManager

        Which may be help you.

        Generally, Login page requires the servers confirmation regarding automatic login.

        Best regards,[/quote]

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          cookieJar() and setCookieJar() from "QNetworkAccessManager": http://doc.qt.nokia.com/stable/qnetworkaccessmanager.html together with cookiesForUrl() and setCookiesFromUrl() from "QNetworkCookieJar":http://doc.qt.nokia.com/stable/qnetworkcookiejar.html

          The rest depends on what you actually want to do, which you did not describe here. Code on stackoverflow that isn't working does not count....

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved