note 17258 added to ref.pfpro

From: Date: Sun, 02 Dec 2001 07:50:49 +0000
Subject: note 17258 added to ref.pfpro
Groups: php.notes 
Request: Send a blank email to php-notes+get-21522@lists.php.net to get a copy of this message
I've updated the pfpro_process_raw FUNCTION to allow one to enable auto length tags. Here's the code: function pfpro_process_raw($transaction, $autoLenTags=1, $url=pfpro_defaulthost, $port=pfpro_defaultport, $timeout=pfpro_defaulttimeout, $proxy_url=pfpro_proxyaddress, $proxy_port=pfpro_proxyport, $proxy_logon=pfpro_proxylogin, $proxy_password=pfpro_proxypassword) { /* This function receives a string, processes it, and then returns a results string. use autoLenTags = 1 to enable auto length tags, or 0 (zero) for no length tags -- the default is 1 For example: pfpro_process_raw(' ... transaction string ... ') will default to 1 if not specified or, pfpro_process_raw(' ... transaction string ... ', 0) will process the string without length tags This functionality is NOT part of the standard pfpro functions as defined in the PHP manual -- I've added this functionality simply because I think it should be here. */ if(!(is_string($transaction))) return(NULL); /* Check to see if autoLenTags is enabled */ if($autoLenTags) { $transaction = str_replace(' & ', ' ASCII(38) ', $transaction); $transArray = explode('&', $transaction); foreach($transArray as $val) list($val1[], $val2[]) = split('=', $val, 2); $cnt = count($transArray); for($x=0; $x<$cnt; $x++) { $val2[$x] = str_replace('ASCII(38)', '&', $val2[$x]); $a[] = $val1[$x] . '[' . strlen($val2[$x]) . ']=' . $val2[$x]; } $transaction = implode('&', $a); } $trans = PFPRO_EXE_PATH . ' '; $trans .= $url . ' '; $trans .= $port . ' "'; $trans .= $transaction . '" '; $trans .= $timeout . ' '; $trans .= $proxy_url . ' '; $trans .= $proxy_port . ' '; $trans .= $proxy_logon . ' '; $trans .= $proxy_password; /* run transaction, if result blank, return(NULL) */ @exec($trans, $result); if($result[0] == NULL) return(NULL); return($result[0]); } -- http://www.php.net/manual/en/ref.pfpro.php http://master.php.net/manage/user-notes.php?action=edit+17258 http://master.php.net/manage/user-notes.php?action=delete+17258 http://master.php.net/manage/user-notes.php?action=reject+17258

« previous php.notes (#21522) next »