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 3347876
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:28:27+00:00 2026-05-18T01:28:27+00:00

I am logging in remotely to a website using cURL and everything is working

  • 0

I am logging in remotely to a website using cURL and everything is working fine. I am posting the login information, retrieving the cookies and being redirected by the remote site. I have a few questions about how the cookies are actually functioning.

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://website' );
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    curl_setopt($ch, CURLOPT_POST, TRUE);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_str);
    curl_setopt($ch, CURLOPT_COOKIEJAR, '/php/cookies.txt');
    curl_setopt($ch, CURLOPT_COOKIEFILE, '/php/cookies.txt');
    $result = curl_exec($ch);
    $x = curl_getinfo($ch);
    print_r($x);

1.) Is there some security issues I need to be concerned about by sending the login information via POST?

2.) When I set the curlopt_cookiejar to /php/cookies.txt, I don’t actually see that file saved anywhere. This may be due to permissions, but the login is working anyways. Why would that be the case? What would be the correct permissions to allow this file to be written to and saved?

3.) Is storing the cookiejar file in plaintext safe? What is the best location to save this file?

4.) If this script is used regularly by multiple users, what is preventing the correct cookie information located in cookies.txt that is sent back to the server using curlopt_cookiefile from being mixed up by other cookies that have been written in this file? What is the best way to approach cookies that expire, and removing old cookies from this file?

This is obviously a very important function of cURL, but I can’t seem to find these answers anywhere. I’m hoping a cURL master can set these questions straight once and for all to see.

  • 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-18T01:28:28+00:00Added an answer on May 18, 2026 at 1:28 am

    1) No

    2)
      2.0) It’s writing to /php – that is, off the root filesystem, in a folder php. Did you check there?
      2.1) The cookiejar would only be used for subsequent requests that do NOT post the login information. At this point, I’m wondering what it is you’re using the cookiejar for…are you certain you even need these cookies? They (shouldn’t) get sent to the third-party site you got redirected to, so what are they doing?
      2.2) The user running PHP (usually the web server) will need write permissions to this file.

    3) As long as you put the cookiejar somewhere on your filesystem that others can’t get arbitrary access to, you should be fine – for example, you probably want to put it somewhere outside the webroot.

    4) If this script is used regularly by multiple users, you’ll almost CERTAINLY get a mix of all different kind of data in that file – which indicates that you should probably be giving each user their own cookiejar file, or something…since the location is just set via a PHP string, you shouldn’t have too much trouble figuring out how to make it dynamic. CURL will take care of not writing expired cookies to the jar during subsequent requests and responses.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After logging in using the Login control the browser loses the session. This only
Currently I am logging stuff and I am using my own formatter with a
For my project purpose, i need to login to my facebook account remotely and
So logging in to my site has suddenly stopped working... I haven't changed the
When logging out or sending (to a web service using RestKit) specifically the subThoroughfare
Using the standard java logging API (import java.util.logging.Logger), after the construction: Logger l =
For logging out a user from my website, I am redirecting the page to
When logging to remote ksh using telnet (either putty or NET::Telnet) the Job Control
i have a simple function i used to use to do login remotely to
Logging into a site I'm working on functions as expected on my local machine

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.