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

curl-and-php

RE: Question: Maintaining separate CURLOPT_COOKIEFILE cookie sessions across multiple browsers

From: Liu Shan Shui <me_at_lx.sg>
Date: Thu, 2 Jul 2009 04:47:32 +0800

Hi Hadiya,

 

Correct me if I’m mistaken, but I’m guessing that you’re trying to send form
data to another site. Take a look at the “Simplified POST request” example
of Curlx:

http://code.google.com/p/curlx/

 

So if you’re simply forwarding POST data through a script on your server,
you can plug $_POST directly into the second parameter:

$curlx = new Curlx;
$response =
$curlx->fetch('http://some.other.site.example.com/some_form.php', $_POST);

 

Or, if you just want your visitor to submit POST data directly to the other
site, you don’t need PHP or cURL at all – just set the action attribute in
your HTML form to the full URL of their form handler will do.

 

Let me know if you have any other questions, or the above is not what you’re
looking for.

 

With regards,

Liu Shan Shui

me_at_lx.sg

"Life would be much easier if I had the source code." - Anonymous

 

From: curl-and-php-bounces_at_cool.haxx.se
[mailto:curl-and-php-bounces_at_cool.haxx.se] On Behalf Of Hadiya Razouk
Sent: Wednesday, July 01, 2009 3:11 PM
To: curl-and-php_at_cool.haxx.se
Subject: RE: Question: Maintaining separate CURLOPT_COOKIEFILE cookie
sessions across multiple browsers

 

hiiiiiiii

plz i want to make simple script
to get data from site and but it my site

i make html form with inputs name same the other site

plz help me

 

ÇáÈÚÖ äÍÈåã
áßä áÇ äÞÊÑÈ ãäåã ........ Ýåã Ýí ÇáÈÚÏ ÃÍáì
æåã Ýí ÇáÈÚÏ ÃÑÞì .... æåã Ýí ÇáÈÚÏ ÃÛáì

 

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

  _____

From: me_at_lx.sg
To: curl-and-php_at_cool.haxx.se
Subject: RE: Question: Maintaining separate CURLOPT_COOKIEFILE cookie
sessions across multiple browsers
Date: Wed, 1 Jul 2009 05:47:19 +0800

Hi Alex,

 

This is an easy one – ingredients as follow:

 

1. A cookies directory chmoded to 777.

2. Sessions

 

On first visit, generate a unique ID for the visitor and store it in a
session variable like $_SESSION[‘cookie_id’]. Then whenever you need a
cookie for storage, set the COOKIE* options as
“cookies/$_SESSION[cookie_id].text”.

 

Tips: Make sure the cookie ID is not revealed anywhere and is unguessable,
and remember to turn off the index listing for the cookies directory or
place a dummy index.html there. Also, do run a cleanup on the cookies
directory regularly before it is flooded with cookie files.

 

I wrote a web proxy script for my now-defunct proxy site several months ago,
and the source code is available here:

http://files.lx.sg/shadyproxy.r139.zip

 

You will probably want to look at line 14 of proxy.php for your case:

if (!isset($_SESSION['cookie_id'])) $_SESSION['cookie_id'] = time() . '_' .
str_pad(mt_rand(0, 9999), 4, '0', STR_PAD_LEFT);

 

Let me know if you have any further questions.

 

With regards,

Liu Shan Shui

me_at_lx.sg

"Life would be much easier if I had the source code." - Anonymous

 

From: curl-and-php-bounces_at_cool.haxx.se
[mailto:curl-and-php-bounces_at_cool.haxx.se] On Behalf Of Alex Judd
Sent: Tuesday, June 30, 2009 11:51 PM
To: curl-and-php_at_cool.haxx.se
Cc: 'Alex Judd'
Subject: Question: Maintaining separate CURLOPT_COOKIEFILE cookie sessions
across multiple browsers

 

Hi Daniel and everyone

 

First post here so a brief Hi and a quick question I wonder if anyone has
any experience (I’ve read around the mailing lists but couldn’t find
anything that directly answered).

 

I’m building a PHP proxy server that uses Curl to read and write from an
existing website, and to return the response to PHP for me to manipulate as
I like.

 

Now the good news is this works pretty well, and POST and GET variables are
being maintained and passed backwards and forwards, as are COOKIES with the
CURLOPT_COOKIEFILE option.

 

However, the problem I have is that if two separate webbrowsers/users access
the system at the same time, they get to share the same cookies and thus can
see each other’s session information etc. [which is obviously not what we
want]

 

Has anyone built a similar system where the COOKIEFILE settings are
maintained on a separate PHP user/session based approach?

 

Many thanks in advance

 

Alex

 

 

  _____

Insert movie times and more without leaving Hotmail®. See how.
<http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutor
ial_QuickAdd_062009>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2009-07-01