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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:21:47+00:00 2026-05-27T08:21:47+00:00

I need to login to some page by cURL in php. I have this

  • 0

I need to login to some page by cURL in php.
I have this script :

$cookie_file = 'cookies.txt';
$c = curl_init();
curl_setopt($c, CURLOPT_URL, 'http://www.xxx.pl/index.php?act=ws&sub=login');
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS, 'login=aaa&pass=bbb');
curl_setopt($c, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT    5.0)");
curl_setopt($c, CURLOPT_REFERER, 'http://www.xxx.pl/index.php');
//curl_setopt($c, CURLOPT_HEADER, 1);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, 0);
//curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_COOKIEFILE, dirname(__FILE__) . '/'.$cookie_file);
curl_setopt($c, CURLOPT_COOKIEJAR, dirname(__FILE__) . '/'.$cookie_file);
curl_exec($c);
curl_close($c);

When i run it the script log me in (i see new date in databse inserting on login) but when I open a site http://www.xxx.pl/ i am not loged.
I think problem is about sessions. But i dont know how to resolve it.

  • 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-27T08:21:47+00:00Added an answer on May 27, 2026 at 8:21 am

    Starting session with cURL and capturing cookie data doesn’t mean that session will be shared between your app and browser.

    If you run script from same domain you need to:

    • Parse cookie data captured by cURL
    • use PHP’s setcookie() function to return same cookie data to your browser.

    After performing these steps browser will send cookies back to the server which initiated session.

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

Sidebar

Related Questions

I have some problem with the injecting of my cookie into login.php page. This
I need to implement for current project some secure login in php. I wrote
I need some advanced CSS help here. I have a login button and a
i have 2 page i need to navigate mainpage.xaml to login.page xaml but it
I have created an app which starts with a login page, after entering some
On my Login.aspx page, before the user is authenticated I need to run some
I have a simple web page that till now didn't need any login. It
I need some help. I had created login page from that page user with
I have some images in content folder that I need to add to login
I need to add some static text in the wordpress login page. How I

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.