curl-and-php
Re: JSP session and curl
Date: Wed, 28 Jul 2004 17:22:51 +0200
thank you for your reply.
the problem is that I don't know how exactly to do it...
----- Original Message -----
From: "Christian Fanzott" <christian_at_tacc.at>
To: "using curl with PHP" <curl-and-php_at_cool.haxx.se>
Sent: Wednesday, July 28, 2004 3:58 PM
Subject: AW: JSP session and curl
> you have to check if any cookie is set and send it with your curl request
by
> using the cookiejar und cookiefile or if any session is send as a hidden
> fild, then you have it to put into your variable list
> the next thing what can be is, that a third page is called where
additional
> cookies are set and then you are redirected to the second link you posted.
> you have to take a look where the first form is send...and from there you
> make a new request to the next page and so on...
> you have to send the request in exact the same order it is done by the
page.
>
> -----Ursprüngliche Nachricht-----
> Von: curl-and-php-bounces_at_cool.haxx.se
> [mailto:curl-and-php-bounces_at_cool.haxx.se]Im Auftrag von Bernhard
> Breisser
> Gesendet: Mittwoch, 28. Juli 2004 15:51
> An: curl-and-php_at_cool.haxx.se
> Betreff: JSP session and curl
>
>
> 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
>
>
>
>
>
>
>
> ---
>
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.725 / Virus Database: 480 - Release Date: 19.07.2004
>
> ---
>
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.725 / Virus Database: 480 - Release Date: 19.07.2004
>
>
Received on 2004-07-28