As mentioned in my previous posts here, I see “JSESSIONID” appearing in Safari’s Console, Cookies section, when I view that MacUSA Login page directly (outside my PHP script). JSESSIONID corresponds to the J2EE (Java 2 platform Enterprise Edition, 1999-2003) web app development framework, not PHP. So is special handling required in a PHP script for this?
Not knowing the answer to the above question, I continue to experiment. I gleaned some tips from Stack Overflow and wrote this script:
<?php
ini_set('display_errors', true);
error_reporting(E_ALL);
$useragent = $_SERVER['HTTP_USER_AGENT'];
$strCookie = 'JSESSIONID=' . $_COOKIE['JSESSIONID'] . '; path=/';
session_write_close(); // end current session and store session data
$curl = curl_init();
curl_setopt($curl, CURLOPT_VERBOSE, true);
curl_setopt ($curl, CURLOPT_URL, "http://hartford.macusa.net/fmi/iwp/cgi?-db=Install_Info.fp7&-startsession");
curl_setopt($curl, CURLOPT_USERAGENT,'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML) Ubuntu Chromium/32.0.1700.107 Chrome/32.0.1700.107 Safari/537.36');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($curl, CURLOPT_HEADER, true); //displays the header info
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
curl_setopt($curl, CURLOPT_COOKIEJAR, 'fmi-cookie');
curl_setopt($curl, CURLOPT_COOKIEFILE, 'fmi-cookie');
$result = curl_exec ($curl);
curl_close ($curl);
print $result;
?>
And to ensure the cookie handling works, I placed the above script inside a folder named “php” on my web server and gave that folder 777 permissions. Even so, the above script results in the following browser error:
Notice: Undefined index: JSESSIONID in /home/jdwages/domains/kiramek.com/public_html/php/test.php on line 6
The offending “line 6” is this:
$strCookie = 'JSESSIONID=' . $_COOKIE['JSESSIONID'] . '; path=/';
Thoughts?
dynamo mailing list
email@hidden
Update your subscriptions at: