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

  • Home
  • SEARCH
  • 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 789347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:30:37+00:00 2026-05-14T21:30:37+00:00

<?php // create a new CURL resource $file_path = ‘/mail’; define(COOKIE_FILE, c:\cookie.txt); $ch =

  • 0
<?php
// create a new CURL resource
$file_path = '/mail';
define("COOKIE_FILE", "c:\cookie.txt");
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://mail.gov.in/iwc/signin");

curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_COOKIESESSION, TRUE);
session_write_close();
$strCookie = 'PHPSESSID=d095af0e30afc021dd3652734009' . $_COOKIE['PHPSESSID'] . '; path=/mail';
curl_setopt( $ch, CURLOPT_COOKIE, $strCookie );
curl_setopt ($ch, CURLOPT_COOKIEJAR, COOKIE_FILE);
curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE_FILE);

curl_setopt ($ch, CURLOPT_POST, 1);

curl_setopt ($ch, CURLOPT_POSTFIELDS,'fromLogin=true&domainName=nic.in&username=&password=&button=Sign%20In');

$url = curl_getinfo($ch);

// grab URL and pass it to the browser
$data = curl_exec($ch);
echo $data."<pre>";

echo "<pre>";
print_r($url);

// close CURL resource, and free up system resources
curl_close($ch);
?>

whats wrong with my code why i am not able to login directly in their mail

  • 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-14T21:30:38+00:00Added an answer on May 14, 2026 at 9:30 pm

    You’re setting a hard-coding a session ID, then loading the COOKIE_FILE. Make sure that there’s not another PHPSESSID cookie in the cookie file already. It may be overriding the session ID you just set manually.

    As well, you’re passing in username and password keys in the POST data, but not actually sending the username and password. Maybe you’ve censored them from this post, but it’s worth pointing out. It should most likely be “….&username=SOMEUSER&password=SOMEPASSWORD”.

    You then do a curl_getinfo(), but you have not yet done the curl_exec() call, so there’s nothing available to get information on, other than some CURL internal settings.

    You may want to check if $data is FALSE before outputting it, in case that something failed within CURL:

    $data = curl_exec($ch);
    $info = curl_getinfo($ch);
    if ($data === FALSE) {
        print("CURL failed: " . curl_error($ch) . "\n");
    }
    var_dump($info); // print out full information array from curl
    var_dump($data); // print out anything the server may have returned
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using PHP curl method to get a string type response. To create
I'm using Eclipse Galileo for PHP Developers and when I create new, empty project
Situation: A PHP application with multiple installable modules creates a new table in database
For a new project that I'm doing in PHP I've created an SQLMethods class
Is there any thing in PHP to create basic scaffold, like in Rails? EDIT:
I found the following code to create a tinyurl.com url: http://tinyurl.com/api-create.php?url=http://myurl.com This will automatically
My attempts to query MySQL from PHP with a create statement of a store
Is it possible to create images with PHP (as opposed to simply linking to
Can you create websites with Chinese characters in PHP? UPDATE: Perhaps I should have
I like Doxygen to create documentation of C or PHP code. I have an

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.