Re: CURL and $_SESSION problem
From: Pedro Graca (hexkid_at_hotpop.com)
Date: 07/10/04
- Next message: MS: "Linux server & windows os"
- Previous message: Stuart Morgan: "Re: Good Text-pad editor for PHP development"
- In reply to: Phil Powell: "Re: CURL and $_SESSION problem"
- Next in thread: Phil Powell: "Re: CURL and $_SESSION problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 10 Jul 2004 14:54:17 GMT
["Followup-To:" header set to comp.lang.php.]
Phil Powell wrote:
>
> "Pedro Graca" <hexkid@hotpop.com> wrote in message
> news:slrnceuhcm.16d.hexkid@ID-203069.user.uni-berlin.de...
>> If Mozilla can do it, so can you with telnet!
>
> Can't with telnet.
>
> telnet <server> <port>
>
> Produces this error:
>
> Connection refused
>
> Apparently the remote server has telnet blocked
Well ... maybe there's a proxy between Mozilla and the server.
>> Let's assume you got the cookie and have it saved in $scraped_cookie.
>> Precede next curl_exec() call with
>>
>> curl_setopt($ch, CURLOPT_COOKIE, $scraped_cookie);
>>
>> This $scraped_cookie will be something like
>> "PHPSESSID=0123456789abcdeffedcba9876543210"
>> (without the quotes, of course), with no spaces before or after, with no
>> semi-colons anywhere, with no line breaks.
>
> Ok did just that as well (will reproduce the code later as I do not have
> direct access to it from here at home), and produced a query string like
> this:
>
> image_catalog=phillip.powell%2Emyphpwebsite.com&PHPSESSID=0123456789abcdeffe
> dcba9876543210
>
> Which is fine, and preceded the curl_exec() call with
>
> curl_setopt($ch, CURLOPT_COOKIE, $qs);
>
> Where $qs = the query string you see above..
Oops! $qs must not have all that. Strip "image_catalog=...website.com&"
from it before setting it up as the cookie, or if you need the two
cookies they should be separated by a colon, not the ampersand:
curl_setopt($ch, CURLOPT_COOKIE, str_replace('&', ':', $qs));
maybe that works ... I'm not sure about the %2E in there.
> But the results would indicate that the second curl_exec(), after setting
> the set-cookie HTTP headers with the previously obtained session id from
> "index.php", would still NOT get the session anyway!
It's not the expected cookie, so the server starts a brand new
connection with a brand new cookie.
-- USENET would be a better place if everybody read: | to email me: use | http://www.catb.org/~esr/faqs/smart-questions.html | my name in "To:" | http://www.netmeister.org/news/learn2quote2.html | header, textonly | http://www.expita.com/nomime.html | no attachments. |
- Next message: MS: "Linux server & windows os"
- Previous message: Stuart Morgan: "Re: Good Text-pad editor for PHP development"
- In reply to: Phil Powell: "Re: CURL and $_SESSION problem"
- Next in thread: Phil Powell: "Re: CURL and $_SESSION problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|