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

curl-and-php

JSP session and curl

From: Bernhard Breisser <strange1_at_gmx.net>
Date: Wed, 28 Jul 2004 15:50:57 +0200

Hey there!

Well, I'm new to the curl functions, so here's my first prob =)

The first page looks like this

https://test.com/jsp/direct_access.do?username=user&password=1234&id=1234567
89

When I copy&paste this link to my browsers address bar it works fine and on
above page is a link whick looks like this:
https://test.com/jsp/set_identcode.do?id=123456789

I want to get the content of this link via CURL and put the output into a
textfile. However I get this message when using CURL:

"Session expired, please login".

How can I manage sessions with CURL? Dunno how it works actually...

Here's my php/curl code:

***************************************************

<?php
$ch = curl_init("https://test.com/jsp/set_identcode.do?id=123456789");
$fp = fopen("test.txt", "w");
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_REFERER,
"https://test.com/jsp/direct_access.do?username=user&password=1234&id=123456
789");
curl_exec($ch);
print_r(curl_error($ch));
curl_close($ch);
fclose($fp);
?>

***************************************************

Can someone maybe even modify the code? I would be soooo grateful =)

I tried the cookie functions in curl but however I do not seem to get it
right ...

Btw, the headers look like this:

***************************************************

HTTP/1.1 200 OK
Date: Wed, 28 Jul 2004 13:38:51 GMT
Server: WebLogic WebLogic Server 6.1 SP3 06/19/2002 22:25:39 #190835
Content-Type: text/html; charset=ISO-8859-1
Set-Cookie:
JSESSIONID=BHssCfB4WbLeoF1zE8e2hlxiOeKpsd1fXEObiT5WqigWDGHdMFI1!-1849211758!
-1606942321!7001!7002; path=/
Cache-control: no-cache="set-cookie"
Transfer-Encoding: chunked

***************************************************

Thanks!
Bernhard
Received on 2004-07-28