Page 1 of 1

curl and session handling

Posted: Thu Aug 24, 2006 10:02 am
by SomeOne
i use CURL to get content of file...
i use session and now i wnat that curl use the already opened session becouse in session i have some strings the curl needs, to gret the proper output of grabed PHP file...
get it?
again :P
1. i use
session_start();
$_SESSION['var1'] = "this";

2. i use curl to get a content of PHP file and i need a session var1 parameter to have the output i want...
i have tryed several things though...nothing seems to work...
i have an idea to tell curl to use already opened session....though....dont know how to do that?
anyone?

Posted: Thu Aug 24, 2006 10:28 am
by feyd
code, please.

Posted: Thu Aug 24, 2006 10:39 am
by SomeOne
CURL code

Code: Select all

$url = "$domena$izpis"; //some php file
 $ch = curl_init();
		curl_setopt($ch, CURLOPT_COOKIE, "mycookie"); //i use my cookie in MY session
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_VERBOSE, 1);
		curl_setopt($ch, CURLOPT_POST, 1);
//		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
        curl_setopt($ch, CURLOPT_TIMEOUT, 120);
        curl_setopt($ch, CURLOPT_USERAGENT, $agent);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);  //Windows 2003 Compatibility
		$response = curl_exec($ch);
		curl_close($ch);
//then i write $response to file like
	if ($handlex = fopen("$datoteka_html", "w"))
	{
	  fwrite($handlex, $response);
	  fclose($handlex);
	  echo "OK";
	  }else{
	  echo "ERROR";
	  }
the code of session

Code: Select all

session_start();
include_once'settings.php';
  $username = $_POST['username'];
  if (file_exists("$users/$username.php"))
{
  $user = file_get_contents("$users/$username.php");
  $user_name = explode ("=", $user);
  $pass_is = $user_name[1];
			//  pass ok
  $password = $_POST['password'];
    if ($pass_is == $password){

  $_SESSION['is_logged']=1;
  setcookie("NewsLimonet", $username, time()+60*60*24*30);  /* expire in 30 days */
  session_set_cookie_params("mycookie"); 

  } else {
  $_SESSION['is_logged']=0;
  }
}
hope this help?

p.s.: @feyd thnx
:D

Posted: Thu Aug 24, 2006 1:56 pm
by SomeOne
anyone?

Posted: Tue Aug 29, 2006 4:11 am
by SomeOne
:roll:

Posted: Tue Aug 29, 2006 4:37 am
by Jenk
4. All users of any level are restricted from bumping (as defined here) any given thread within twenty-four (24) hours of its last post. Non-trivial posts are not considered bumping. A bump post found in violation will be deleted, and you may or may not recieve a warning. Persons bumping excessively be considered as spammers and dealt with accordingly.
viewtopic.php?t=30037