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

curl-and-php

cURL Cookie Trouble - Need Help!

From: Tim Parkin <tparkin_at_gmail.com>
Date: Sun, 4 Jun 2006 12:43:40 -0700

Hi,

I'm writing a PHP script to access a website via SSL using cURL. It
works fine on my local machine, but when I try it on my shared hosting
account it doesn't behave the same.

First, the page I'm trying to access gives a 302 which is no big deal.
 cURL then follows the 302 without problem. The trouble starts here,
when cURL goes to write the cookie. On my local machine cURL writes
the cookie in full, however, on my shared hosting the cookie does not
have the same variables/values and thus causes the page to give an
error since it requires cookies.

Another example that illustrates the problem is that if I run the
script on my local machine, it works. Then if I take the cookie file
it generated and put it on my shared hosting, the script will also
work there. So obviously it's a problem with the cooke not being
written correctly or something involving the cookie.

At first I thought this was my fault (and perhaps it is!) but as I
spend more time on it I'm starting to think it might be caused by the
way my shared hosting server is setup or their version of cURL.
Here's a comparison of cURL versions between my local machine and my
shared hosting:

Local Machine: CURL Information libcurl/7.14.0 OpenSSL/0.9.8a zlib/1.2.3
Shared Hosting: CURL Information libcurl/7.10.6 OpenSSL/0.9.7a ipv6 zlib/1.1.4

Also, here's a link to the PHP page on my shared hosting server so
that you can see the Peoplesoft Error I get due to not having the
right variables set in the cookie:
http://www.collegeclasses.org/Schools/test2.php
And the source of that page can be viewed here:
http://www.collegeclasses.org/Schools/test2.php.txt

The output of the PHP code from my local machine can be found at:
http://www.collegeclasses.org/Schools/local.txt
The output of the PHP code from my shared hosting can be found at:
http://www.collegeclasses.org/Schools/shared.txt

I mention this because if you look at the headers you can see the
differences, and it's interesting to see how on the shared hosting the
redirect from the 302 doesn't work correctly (again, I'm pretty sure
it's because of the cookie problem).

Any help is greatly appreciated. I've been struggling with this for
too many hours. many hours.

Thanks!

-- 
Tim Parkin
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2006-06-04