a786 Writing RE in PHP 5 - Writing PHP
Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Writing RE in PHP 5

Posted by buttsp (buttsp), 11 May 2006
hi folks,
           I need a little help regarding creating a regular expression for extracting the JSESSIONID value i.e. (7A414D4CEF1B72C6A815559ABA776941) from the following HTTP header:

---------------------------------
HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Expires: -1 Pragma: no-cache Cache-Control: no-cache Set-Cookie: JSESSIONID=7A414D4CEF1B72C6A815559ABA776941; Path=/travelsearch Content-Type: text/xml;charset=ISO-8859-1 Content-Length: 93 Date: Wed, 10 May 2006 17:33:52 GMT
----------------------------------

Any help would be appreciated.

Posted by admin (Graham Ellis), 11 May 2006
<?php
$xxx = "summat...PHPSESSID=712783127ABD78932; ... more";
preg_match('/PHPSESSID=([0-9A-F]+)/',$xxx,$igot);
print $igot[1];
?>



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2013: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho
0