I opted for another solution. I use this script to connect with the second app automatically without going through the form filling box. It works fine, but there seems to be a problem with the cookie, the session is not maintained when I change pages.
An idea ?
Here is the script:
<?php $path_cookie = dirname(__FILE__).'/cookie.txt';
$script = curl_init();
curl_setopt($script, CURLOPT_URL, 'XXXXXdo=login§ok=');
curl_setopt($script, CURLOPT_USERAGENT,'Mozilla/5.0 (X11; Linux x86_64)');
curl_setopt($script, CURLOPT_POST, true);
curl_setopt($script, CURLOPT_POSTFIELDS, "u=XXXX&p=XXXX");
curl_setopt($script, CURLOPT_RETURNTRANSFER, true);
curl_setopt($script, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($script, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($script, CURLOPT_CONNECTTIMEOUT, 120);
curl_setopt($script, CURLOPT_TIMEOUT, 120);
curl_setopt($script, CURLOPT_MAXREDIRS, 10);
curl_setopt($script, CURLOPT_COOKIESESSION, true);
curl_setopt($script, CURLOPT_COOKIEJAR, $path_cookie);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
$connexion = curl_exec($script);
if (curl_error($script)) {
echo curl_error($script);
}
else
{
curl_setopt($script, CURLOPT_URL, 'XXXXX&do=admin');
curl_setopt($script, CURLOPT_POST, true);
curl_setopt($script, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($script, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($script, CURLOPT_COOKIEFILE,$path_cookie);
curl_setopt($script, CURLOPT_POSTFIELDS, "");
$contenu = curl_exec($script);
curl_close($script);
if (curl_error($script)) {
echo curl_error($script);
}
else
{
echo $contenu;
}
} ?>
Thanks for your help