cURL | open site and save session information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello

I need to open page from site from PHP

to open this site I should send usename and password and then I should get
session on that site to not enter the username and password again

I need to do this with PHP send username and password in the first time and
then use the session information

Now I'm using the script below but with this script I should send username
and password every time and every time get new session

Please I need to know how I can use session information in second time

$ch = curl_init('https://xxxxxxxxxxx.xxx');
  curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
  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_REFERER, $url . "index.html");
  $fp = fopen($fileName, "w");
  curl_setopt ($ch, CURLOPT_FILE, $fp);

  curl_setopt ($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

  $args = array("auth_user" => "XXXXXXXXX", "auth_password" => "XXXXXXXX");
  curl_setopt ($ch, CURLOPT_POSTFIELDS, $args);
  curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
  curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');

Please help !!


[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux