Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7689925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:16:41+00:00 2026-05-31T20:16:41+00:00

Just wondering if it’s possible to use an XMLHTTPReq to login to a website,

  • 0

Just wondering if it’s possible to use an XMLHTTPReq to login to a website, and store the cookie. Specifically I’m after the PHPSessionID from the website I am logging into.

I then want to pass this cookie into another request to submit a form.

Any ideas of how to do this?

Cheers,
Nick

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:16:42+00:00Added an answer on May 31, 2026 at 8:16 pm

    You will be able to get your own site’s cookies from document.cookie. In the AJAX callback, use a library to parse the value and read the cookie you’re looking for.

    Of course, if the server sets the cookie HttpOnly (which it should be doing), it won’t be available in document.cookie.

    At this pont, you need to reevaluate what you’re doing:

    • If the form points to your website, your server script would have access to the cookie anyway.
    • If you’re sending the user’s session ID to another domain, why? This is a huge red flag that screams security problem.

    If you’re logging in to another site, then no – the same-origin policy prevents you from accessing another site’s cookies.


    Edit: Since this is for your own use, you can do this in a way you’re not limited by the browser’s origin restrictions. Some thoughts:

    • You could make a Chrome extension. Extensions aren’t subject to origin restrictions, and the development model and API is pretty much the same as what you’d do on a regular web page.
    • You could use Node, which has no restrictions. You’d be able to invoke your script from the command line, but the API is going to be slightly different that what you’d use in a web page.
    • Use your language and framework of choice to POST to the login page, get the Set-Cookie header in the response, and use it to send a Cookie header in another POST to the form target.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just wondering is it possible to build CLI app that can be run from
Just wondering will it be possible to passing a value from one page (window
just wondering how it would be possible to recursively search through a website folder
Just wondering when do you actually use $.get(index); I am a bit confused on
Just wondering if it's possible to apply a *.css to a spark TextArea? If
Just wondering what the best practice for handling login/user authentication in mvc3 would be.
just wondering whether it's possible to change the screen timeout using code in Android
Just wondering whether it is possible to convert highly normalized data into binary and
Just wondering if what I want to do is possible with Solr: I have
Just wondering as to how did Google code this website without it reloading the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.