cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

RE: Maintining a session

From: Lee French <lee.french_at_isev.co.uk>
Date: Thu, 8 May 2008 00:02:29 +0100

Many thanks for this, do you happen to have an example of sending the cookie
session via header prior to the redirect ? Cheers.

 

Kind Regards,

 

Lee French // iSev Limited // website design - website applications -
website hosting

 T. 08700 347 913 // M. 07946 586 598 // E. <mailto:lee.french_at_isev.co.uk>
lee.french@isev.co.uk // W. <http://www.isev.co.uk/> www.isev.co.uk

 

Would you like to see our work? <http://www.isev.co.uk/web-design>
www.isev.co.uk/web-design

 

From: curl-and-php-bounces_at_cool.haxx.se
[mailto:curl-and-php-bounces_at_cool.haxx.se] On Behalf Of Stephen Pynenburg
Sent: 07 May 2008 21:15
To: curl with PHP
Subject: Re: Maintining a session

 

cURL session and cookies are always separate from the browser's. You'll have
to send a Set-Cookie header along with the redirect header, using the
cookies that you have saved to /tmp/mycookie .

-Stephen

2008/5/7 Lee French <lee.french_at_isev.co.uk>:

Dear Group,

 

I am in the process of writing a php script that adds items to a shopping
cart on another website and then performs a header redirect to the cart page
on the other website. However, at the moment my curl session is not
maintained on the redirect session (which I expected to be honest). Is it
possible for me to maintain the session used during the curl interactivity?
This is an example of the code I am using :

 

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,
"http://www.cartwebsite.co.uk/index.php?action=showbasket
<http://www.cartwebsite.co.uk/index.php?action=showbasket&_prodid=>
&_prodid=".$_POST['panel_select']."&_qty=".$_POST['panelqty']);

curl_setopt($ch, CURLOPT_HEADER, 0);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch,CURLOPT_FOLLOWLOCATION,0);

curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/mycookie");

curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/mycookie");

curl_exec($ch);

curl_close($ch);

 

header('location:
http://www.cartwebsite.co.uk/index.php?action=showbasket');

 

If I set RETURNTRANSFER to be 0 the session is maintained of course and
content echoes however I wish to allow users to continue on the redirect
website with their cart items intact. I hope this makes sense and any help
you can give me would be great. Many thanks.

 

Kind Regards,

 

Lee French // iSev Limited // website design - website applications -
website hosting

 T. 08700 347 913 // M. 07946 586 598 // E. <mailto:lee.french_at_isev.co.uk>
lee.french@isev.co.uk // W. <http://www.isev.co.uk/> www.isev.co.uk

 

Would you like to see our work? <http://www.isev.co.uk/web-design>
www.isev.co.uk/web-design

 

iSev Limited, e-Innovation Centre SE119, Shifnal Road, Priorslee, Telford,
TF2 9FT

 

 

----------------------------------------------------------------------------
--------------

This email and its attachments may be confidential and are intended solely
for the use of the individual to whom it is addressed. Any views or opinions
expressed are solely those of the author and do not necessarily represent
those of "iSev Limited".

 

If you are not the intended recipient of this email and its attachments, you
must take no action based upon them, nor must you copy or show them to
anyone. Although we operate anti-virus programmes, we cannot guarantee that
this email and any files transmitted with it are virus free and we cannot
accept liability for any damage sustained as a result of the software
viruses.

 

Please contact the sender if you believe you have received this email in
error. For more information on iSev Limited, visit our website at:
<http://www.220i.co.uk/> http://www.isev.co.uk

 

Registered in England and Wales - Company Number: 6553217. Registered
Offices: iSev Limited, e-Innovation Centre SE119, Shifnal Road, Priorslee,
Telford, TF2 9FT

 

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

 

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-05-08