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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:05:35+00:00 2026-06-11T11:05:35+00:00

How can I, or is it even possible to alter the permissions that curl

  • 0

How can I, or is it even possible to alter the permissions that curl writes it’s cookie jar file with? I’m trying to retrieve session cookies [for an sso plugin] and can get the cookie file written, but when I go to read the file the permissions are 600 & I can’t open the file to parse the content…. basically I need to set the permissions to 644.

<?php


$username = 'xxxxxxxxxxx';
$password = 'xxxxxxxxxxxxxxx';

$ckfile = tempnam("./", "MOODCOOKIE_");

//set POST variables
$url = 'http://domain.com/login/index.php';
$fields_string = 'username='.$username.'&password='.$password.'&rememberusername=1&Login';
rtrim($fields_string, '&');

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch,CURLOPT_COOKIEJAR, $ckfile);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);

//curl_setopt($ch,CURLOPT_FOLLOWLOCATION, true );
curl_setopt($ch,CURLOPT_AUTOREFERER, true );


//execute post
$content = curl_exec($ch);
$response = curl_getinfo( $ch );

echo '<br /><pre>';
print_r($response);
echo '<br /></pre>';

$file_handle = fopen($ckfile, "r");

while (!feof($file_handle)) {
   $line = fgets($file_handle);
   echo $line.'<br />';
}
fclose($file_handle);



//close connection
curl_close($ch);

return $yourcookie;

?>
  • 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-06-11T11:05:36+00:00Added an answer on June 11, 2026 at 11:05 am

    chmod doesnt works?

    chmod($ckfile,0644);
    

    https://www.php.net/manual/es/function.chmod.php

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

Sidebar

Related Questions

How is it possible that following code even compiles? As far as I can
I can't seem to upload an image using Zend_Service_Nirvanix. Is it even possible? I
Possible Duplicate: Getting odd/even part of a sequence with LINQ How can I get
I'm so new to this that I can't even phrase the question right... Anyway,
I trying to fix a strange bugg. People with IOS 4 can't even start
I heard that calling a handler (delegate, etc.) in Objective-C can be even faster
is that even possible? What I'm currently doing is using this code wherein after
I am trying to work out a way to alter the session timeout dynamically,
I can't find anything discussing the case where there are multiple possible indexes that
I can't even get off the ground.I DO KNOW HOW TO ADD REFERENCES, (this.mshtml

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.