PDA

View Full Version : cURL Cookie Trouble


tparkin
06-04-2006, 12:21 PM
I'm working on a PHP script that uses cURL and cookies. It runs fine on my local machine and writes all of about 5 variables to the cookie. When I run it on my shared hosting, only 2 of the variables are written to the cookie and they don't have the correct values. I am using the same version of PHP and have also tested this on the latest version of PHP. Does anyone have any advice on what might be causing this change in behavior?

Thanks in advance.

-tparkin

tparkin
06-04-2006, 02:05 PM
Just thought this might help illustrate what the real problem is. Here are the HTTP headers from my request. The first are from my local machine, the second is from my shared hosting. You can see that after cURL resolves the 302, it gets the correct document on my local machine but goes to an error page instead on my shared hosting.

////////////////////////////////////////////////////////////
// Local Machine Headers
////////////////////////////////////////////////////////////

HTTP/1.1 302 Moved Temporarily
Location: https://sahr.cc.ucf.edu/servlets/iclientservlet/heprod/?ICType=Panel&Menu=SA_LEARNER_SERVICES&Market=GBL&PanelGroupName=CLASS_SEARCH&RL=&target=main0&navc=0&adss=true&
Server: WebLogic 5.1.0 Service Pack 12 04/14/2002 23:14:36 #178459 - 128 bit domestic version
Content-Length: 529
Content-Type: text/html
Set-Cookie: SignOnDefault=; domain=.ucf.edu; expires=Sunday, 11-Jun-2006 19:01:18 GMT; path=/
Set-Cookie: SAHR3-80-WebLogicSession=RIMt1jW0PsKl484UxL3q1DAQn4OvYdG1CE atGNQC7j9d8JIfa0o5|-8464668797202109986/-2069172281/6/80/80/443/443/80/-1; domain=.ucf.edu; path=/
Connection: Close

HTTP/1.1 200 OK
Server: WebLogic 5.1.0 Service Pack 12 04/14/2002 23:14:36 #178459 - 128 bit domestic version
Content-Length: 8599
Content-Type: text/html; CHARSET=UTF-8
Expires: Thu, 01 Dec 1994 16:00:00 GMT
Connection: Keep-Alive
Set-Cookie: SignOnDefault=GUEST; domain=.ucf.edu; expires=Sunday, 11-Jun-2006 19:01:19 GMT; path=/
Set-Cookie: PS_TOKEN=AAAAmgECAwQAAQAAAAACvAAAAAAAAAAsAARTaGRyA gBOaQgAOAAuADEAMBSVG/BV1yQaBd9S7iJQkVvwZsYesQAAAFoABVNkYXRhTnicRYZLDkAw AAWnJRbiKkSlkXRPaoX4HMIdHc6rBW+SeQNcxmY5Bs3eySWRk5 Gdo9DNxIpJsbKxMHg6WtFTf/ayE4062RHe/nkAKBcKlw==; domain=.ucf.edu; path=/; secure
Set-Cookie: PS_TOKENEXPIRE=4_Jun_2006_19:01:19_GMT; domain=.ucf.edu; path=/
Set-Cookie: PS_LOGINLIST=https://sahr.cc.ucf.edu/heprod; domain=.ucf.edu; path=/
Set-Cookie: ExpirePage=https://sahr.cc.ucf.edu/servlets/iclientservlet/heprod/; domain=.ucf.edu; path=/
Set-Cookie: SignOnDefault=GUEST; domain=.ucf.edu; expires=Sunday, 11-Jun-2006 19:01:19 GMT; path=/
Set-Cookie: PS_TOKEN=AAAAmgECAwQAAQAAAAACvAAAAAAAAAAsAARTaGRyA gBOaQgAOAAuADEAMBSVG/BV1yQaBd9S7iJQkVvwZsYesQAAAFoABVNkYXRhTnicRYZLDkAw AAWnJRbiKkSlkXRPaoX4HMIdHc6rBW+SeQNcxmY5Bs3eySWRk5 Gdo9DNxIpJsbKxMHg6WtFTf/ayE4062RHe/nkAKBcKlw==; domain=.ucf.edu; path=/; secure
Set-Cookie: PS_TOKENEXPIRE=4_Jun_2006_19:01:19_GMT; domain=.ucf.edu; path=/
Set-Cookie: PS_LOGINLIST=https://sahr.cc.ucf.edu/heprod; domain=.ucf.edu; path=/
Set-Cookie: ExpirePage=https://sahr.cc.ucf.edu/servlets/iclientservlet/heprod/; domain=.ucf.edu; path=/
PortalRegisteredURL: https://sahr.cc.ucf.edu/servlets/iclientservlet/heprod/?ICType=Panel&Menu=SA_LEARNER_SERVICES&Market=GBL&PanelGroupName=CLASS_SEARCH






////////////////////////////////////////////////////////////
// Shared Hosting Headers
////////////////////////////////////////////////////////////

HTTP/1.1 302 Moved Temporarily
Location: https://sahr.cc.ucf.edu/servlets/iclientservlet/heprod/?ICType=Panel&Menu=SA_LEARNER_SERVICES&Market=GBL&PanelGroupName=CLASS_SEARCH&RL=&target=main0&navc=0&adss=true&
Server: WebLogic 5.1.0 Service Pack 12 04/14/2002 23:14:36 #178459 - 128 bit domestic version
Content-Length: 529
Content-Type: text/html
Set-Cookie: SignOnDefault=; domain=.ucf.edu; expires=Sunday, 11-Jun-2006 19:01:50 GMT; path=/
Set-Cookie: SAHR3-80-WebLogicSession=RIMuHgHu3Q01GZK1An0ac2ueWyO0BCpYKW hhM0nsFuut37EzWMgl|-8464668797202109986/-2069172281/6/80/80/443/443/80/-1; domain=.ucf.edu; path=/
Connection: Close

HTTP/1.1 200 OK
Server: WebLogic 5.1.0 Service Pack 12 04/14/2002 23:14:36 #178459 - 128 bit domestic version
Content-Length: 5122
Content-Type: text/html; charset=UTF-8
Expires: Thu, 01 Dec 1994 16:00:00 GMT
Connection: Keep-Alive
Cache-Control: no-store
Set-Cookie: SignOnDefault=; domain=.ucf.edu; expires=Sunday, 11-Jun-2006 19:01:51 GMT; path=/

tparkin
06-04-2006, 07:11 PM
I just tested this with another host and it works fine there. That host is running an older version PHP but has a more recent version of cURL and OpenSSL. I am now certain that this is the problem. Could you please upgrade to the latest version of cURL and OpenSSL? Thanks in advance.

Ray
06-06-2006, 03:44 PM
Hello,

If you could open up a support ticket for this matter, we will gladly investigate the feasibility of upgrading these for you.

Thanks.

Kevin
06-06-2006, 07:47 PM
I am not sure those headers could be delivered by our shared hosting servers because the server line is wrong. It should read something along the lines of:

Server: Apache/1.3.34 (Unix) PHP/4.4.2 mod_ssl/2.8.25 OpenSSL/0.9.7a mod_perl/1.29 FrontPage/5.0.2.2635

Your server responses seem to come from a server that identifies itself as:

Server: WebLogic 5.1.0 Service Pack 12 04/14/2002 23:14:36 #178459 - 128 bit domestic version

You might want to double check you're communicating with the right system or looking at the right headers.