Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $xml2 = thunkagexml_load_string( $xmlString, "messageID=" );
- // $xml2 = thunkagexml_load_string( $xmlString, "notificationID=" );
- // if this is in a loop then add onto the arrays with following:
- if($xml2)
- $MailBodies += $xml2;
- function thunkagexml_load_string( $xmlString, $fieldType )
- {
- // simplexml_load_string is unable to handle the CDATA stuff, therefore using my own interpreter - used for mailbodies
- // fieldType for mailbodies = "messageID="
- // fieldType for notificationtexts = "notificationID="
- if(strpos($xmlString,"<row ".$fieldType) !== false)
- {
- while($rowStart = strpos($xmlString,"<row ".$fieldType, $rowEnd))
- {
- $rowEnd = strpos($xmlString, "]]></row>", $rowStart);
- $messageIDStart = $rowStart + 6 + strlen($fieldType);
- $messageIDEnd = strpos($xmlString, '"><![CDATA[', $rowStart);
- $messageBodyStart = $messageIDEnd + 11;
- $messageID = (integer)substr($xmlString,$messageIDStart,($messageIDEnd - $messageIDStart));
- $messageBody = (string)substr($xmlString,$messageBodyStart,($rowEnd - $messageBodyStart));
- $tmp[$fieldType] = $messageID;
- $tmp['messageBody'] = $messageBody;
- //var_dump($tmp);
- $returnArray[$messageID] = $tmp;
- $tmp = NULL;
- }
- return $returnArray;
- } else {
- return NULL;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment