curl-and-php
RE: [Cookie] Handle a servlet session.
Date: Fri, 18 Oct 2002 19:06:49 +0200
Hi all,
>This does work in PHP. tho it has problems if you use multiple calls to
>curl_setopt to set POST data.
>If you're doing this its better to use the multiple init approach.
Thanks for the info, I'll try this when I could post ;-)
Anyway the simulation of the navigation works very well, I received the
oap_customer_select.jsp page
directly into my browser :-) Here is the code:
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL,
"https://my.serveur/servlet/oapdev?username=user&password=pass&action=Login&
target=_top");
curl_setopt($ch, CURLOPT_COOKIEJAR, "C:\Program Files\Apache
Group\Apache\htdocs\cookie.txt");
ob_start(); // prevent any output
curl_exec ($ch); // execute the curl command
curl_setopt($ch, CURLOPT_COOKIEFILE, "C:\Program Files\Apache
Group\Apache\htdocs\cookie.txt");
curl_setopt ($ch, CURLOPT_URL,
"https://my.serveur/servlet/oapdev?page=oap_fset_after_login.jsp");
curl_exec ($ch);
curl_setopt($ch, CURLOPT_COOKIEFILE, "C:\Program Files\Apache
Group\Apache\htdocs\cookie.txt");
curl_setopt ($ch, CURLOPT_URL,
"https://my.serveur/eng/oap_fset_after_login.jsp");
curl_exec ($ch);
ob_end_clean(); //allow ouput
curl_setopt($ch, CURLOPT_COOKIEFILE, "C:\Program Files\Apache
Group\Apache\htdocs\cookie.txt");
curl_setopt ($ch, CURLOPT_URL,
"https://my.serveur/eng/user/oap_customer_select.jsp");
curl_exec ($ch); // execute the curl command
curl_close($ch);
For the second request, I tried to use curl_setopt($ch, CURLOPT_COOKIEFILE,
1) and curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1)instead of
curl_setopt($ch, CURLOPT_COOKIEFILE, "...cookie.txt") and curl_setopt ($ch,
CURLOPT_URL,
https://my.serveur/servlet/oapdev?page=oap_fset_after_login.jsp") but it
didn't work...doesn't matter...
=> The new problem now is that to get the page that I want, I need to click
on a javascript image:
HREF="javascript:onClickTree ('128840501','cmd=activate','main_content')"
I looked for a solution to execute a javascript into PHP but I founded
nothing, if you have any idea...
=> Another problem is a java pb but who knows, maybe have you already heard
about that. When I try to access
with the previous code to a particular page, I've got this message:
java.lang.RuntimeException: root node not set.
Something is missing in my request but I don't know what yet. When I found
it, how can I include this new
information into my request?
Thanks a lot for reading this.
Jerome.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-10-18