Last active
February 5, 2018 05:44
-
-
Save Mopster/7074a3dda8b1c08528244a40fc003b9b to your computer and use it in GitHub Desktop.
Bullhorn : Uncompress email message body
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* PHP code to get readable email message bodies from Bullhorn backup, UserMessage table, commentsCompressed field | |
* | |
* Bullhorn Support thread : http://supportforums.bullhorn.com/viewtopic.php?f=34&t=1672 | |
* | |
* Thanks to // https://www.experts-exchange.com/questions/28711056/Uncompressing-a-GZIP-string-in-PHP-that-was-compressed-in-Java.html | |
*/ | |
/** $commentsCompressed contains the value of the commentsCompressed column of the UserMessage table */ | |
// Remove the '0x' from the start of the string | |
$hex = substr($commentsCompressed, 2); | |
// Convert from HEX to binary | |
$bin = hex2bin($hex); | |
// Decode using zlib | |
$text = zlib_decode($bin); // Contains the readable body of the email message | |
// Encode to UTF-8 (Had issues with saving this to MySQL) | |
$result = utf8_encode($text); // Contains the UTF-8 encoded body of the email message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment