[PHP] need help with cookies

2003-08-18 Thread Dan Anderson
I need to grab cookies from a web page and pass those cookies back to
the web page when needed.  I downloaded the cURL program and was playing
with it, but don't understand how cURL functions correlate into the PHP
equivalents.

How would I strip the cookies from a web page, and send cookies?
More importantly, if I have cookies from domain x which provides y
cookies and go to a second web page from domain x which provides z
cookies, if I go to another web page on domain x should I concatanate
the y and z cookies, or just send the last z cookies recieved?

Thanks in advance,

Dan Anderson


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] need help with cookies

2003-08-18 Thread Curt Zirzow
* Thus wrote Dan Anderson ([EMAIL PROTECTED]):
 I need to grab cookies from a web page and pass those cookies back to
 the web page when needed.  I downloaded the cURL program and was playing
 with it, but don't understand how cURL functions correlate into the PHP
 equivalents.
 
 How would I strip the cookies from a web page, and send cookies?
 More importantly, if I have cookies from domain x which provides y
 cookies and go to a second web page from domain x which provides z
 cookies, if I go to another web page on domain x should I concatanate
 the y and z cookies, or just send the last z cookies recieved?

Send back all cookies that follow the rules here:
http://wp.netscape.com/newsref/std/cookie_spec.html

That is of course you want to accept the cookie.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] need help with cookies

2003-08-18 Thread Jaap van Ganswijk
At 2003-08-18 16:17 -0400, Dan Anderson wrote:
I need to grab cookies from a web page and pass those cookies back to
the web page when needed.  I downloaded the cURL program and was playing
with it, but don't understand how cURL functions correlate into the PHP
equivalents.

I don't know cURL, but when you want to get the cookies that
a server sends, whilst sending a page, I think you need to
use the fsockopen() function and send a proper GET or HEAD
or whatever command (see the manual under fsockopen).
This way, you'll also get the header of the HTML file
that is being send to you and that is what contains the
cookies.

How would I strip the cookies from a web page, and send cookies?

You'd strip the cookies by interpreting the appropriate lines.

To send cookies, put them in the header of the GET request
that I described above. (But of the next request of course.)

More importantly, if I have cookies from domain x which provides y
cookies and go to a second web page from domain x which provides z
cookies, if I go to another web page on domain x should I concatanate
the y and z cookies, or just send the last z cookies recieved?

Cookies themselves specify to which documents on other parts
of the domain they should be returned. It's quite complicated.
Look for a link to the Netscape specification about this in
the PHP manual under cookies, header() etc.

Success!
Jaap

PS. I have also been fighting the cookie-monster again today! ;-)


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] need help with cookies

2001-03-22 Thread kris

Hi, I am trying to set a cookie and it doesn't work.  I am running IE 5.
I have IE set to prompt before setting cookies but I never get a prompt.

Here is my code - basically, if someone logs in, it is to set a cookie.
What am I missing?   Kris

if($success==1){
$loginid="$id";
NewSessionID($id);
GetProfile($id);
$page_title="LTT: $loginid Index";
include("html-head.php3");
if($id==""){
include("ln/ln_ln_dna.php3");
exit;
}
include("ms/rg1/index.php3");
exit;
}

function NewSessionID($id){
$sid="";
$length=16;
srand((double)microtime()*100);
$SessPool = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$SessPool .= "abcdefghijklmnopqrstuvwxyz";
$SessPool .= "0123456789";

for($tempslime=0; $tempslime  $length; $tempslime++) {
$sid .= substr($SessPool, (rand()%(strlen($SessPool))), 1);
}
setcookie("LoginAuth", $sid,time()+3600);
}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] need help with cookies

2001-03-22 Thread Brian V Bonini

I believe you need to set the cookie
before any other header information is 
passed.

-brian

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, March 22, 2001 2:23 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] need help with cookies
 
 
 Hi, I am trying to set a cookie and it doesn't work.  I am running IE 5.
 I have IE set to prompt before setting cookies but I never get a prompt.
 
 Here is my code - basically, if someone logs in, it is to set a cookie.
 What am I missing?   Kris
 
 if($success==1){
 $loginid="$id";
 NewSessionID($id);
 GetProfile($id);
 $page_title="LTT: $loginid Index";
 include("html-head.php3");
 if($id==""){
 include("ln/ln_ln_dna.php3");
 exit;
 }
 include("ms/rg1/index.php3");
 exit;
 }
 
 function NewSessionID($id){
 $sid="";
 $length=16;
 srand((double)microtime()*100);
 $SessPool = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 $SessPool .= "abcdefghijklmnopqrstuvwxyz";
 $SessPool .= "0123456789";
 
 for($tempslime=0; $tempslime  $length; $tempslime++) {
 $sid .= substr($SessPool, 
 (rand()%(strlen($SessPool))), 1);
 }
 setcookie("LoginAuth", $sid,time()+3600);
   }
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] need help with cookies

2001-03-22 Thread kris

I beleive I am attempting to set this cookie before any headers are sent.
?
Kris
On 22 Mar 01, at 14:38, Brian V Bonini wrote:

 I believe you need to set the cookie
 before any other header information is 
 passed.
 
 -brian
 
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, March 22, 2001 2:23 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] need help with cookies
  
  
  Hi, I am trying to set a cookie and it doesn't work.  I am running IE 5.
  I have IE set to prompt before setting cookies but I never get a prompt.
  
  Here is my code - basically, if someone logs in, it is to set a cookie.
  What am I missing?   Kris
  
  if($success==1){
  $loginid="$id";
  NewSessionID($id);
  GetProfile($id);
  $page_title="LTT: $loginid Index";
  include("html-head.php3");
  if($id==""){
  include("ln/ln_ln_dna.php3");
  exit;
  }
  include("ms/rg1/index.php3");
  exit;
  }
  
  function NewSessionID($id){
  $sid="";
  $length=16;
  srand((double)microtime()*100);
  $SessPool = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  $SessPool .= "abcdefghijklmnopqrstuvwxyz";
  $SessPool .= "0123456789";
  
  for($tempslime=0; $tempslime  $length; $tempslime++) {
  $sid .= substr($SessPool, 
  (rand()%(strlen($SessPool))), 1);
  }
  setcookie("LoginAuth", $sid,time()+3600);
  }
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
  
  
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] need help with cookies

2001-03-22 Thread Chris Lee

as allready stated you need to set the cookie before data is outpued, you can override 
this by editing your php.ini 

output_buffering = on;

on another note, I would use sessions for all this, youve created a tone of code that 
does almost exactly what sessions can do in a matter of a few lines.

-- 

 Chris Lee
 [EMAIL PROTECTED]


[EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hi, I am trying to set a cookie and it doesn't work.  I am running IE 5.
I have IE set to prompt before setting cookies but I never get a prompt.

Here is my code - basically, if someone logs in, it is to set a cookie.
What am I missing?   Kris

if($success==1){
$loginid="$id";
NewSessionID($id);
GetProfile($id);
$page_title="LTT: $loginid Index";
include("html-head.php3");
if($id==""){
include("ln/ln_ln_dna.php3");
exit;
}
include("ms/rg1/index.php3");
exit;
}

function NewSessionID($id){
$sid="";
$length=16;
srand((double)microtime()*100);
$SessPool = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$SessPool .= "abcdefghijklmnopqrstuvwxyz";
$SessPool .= "0123456789";

for($tempslime=0; $tempslime  $length; $tempslime++) {
$sid .= substr($SessPool, (rand()%(strlen($SessPool))), 1);
}
setcookie("LoginAuth", $sid,time()+3600);
}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] need help with cookies

2001-03-22 Thread Jack Sasportas

I would suggest for you to take all the complicated stuff out of a simple text
script and try something like this:
%
setcookie("TestValue","Working",600)
%

Make sure that nothing is being sent prior to setting the cookie, and see if IE
prompts you...

Good Luck!

[EMAIL PROTECTED] wrote:

 Hi, I am trying to set a cookie and it doesn't work.  I am running IE 5.
 I have IE set to prompt before setting cookies but I never get a prompt.

 Here is my code - basically, if someone logs in, it is to set a cookie.
 What am I missing?   Kris

 if($success==1){
 $loginid="$id";
 NewSessionID($id);
 GetProfile($id);
 $page_title="LTT: $loginid Index";
 include("html-head.php3");
 if($id==""){
 include("ln/ln_ln_dna.php3");
 exit;
 }
 include("ms/rg1/index.php3");
 exit;
 }

 function NewSessionID($id){
 $sid="";
 $length=16;
 srand((double)microtime()*100);
 $SessPool = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 $SessPool .= "abcdefghijklmnopqrstuvwxyz";
 $SessPool .= "0123456789";

 for($tempslime=0; $tempslime  $length; $tempslime++) {
 $sid .= substr($SessPool, (rand()%(strlen($SessPool))), 1);
 }
 setcookie("LoginAuth", $sid,time()+3600);
 }

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
___
Jack Sasportas
Innovative Internet Solutions
Phone 305.665.2500
Fax 305.665.2551
www.innovativeinternet.com
www.web56.net



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]