Skip to content

Instantly share code, notes, and snippets.

@mpstenson
Created June 20, 2016 15:20
Show Gist options
  • Save mpstenson/4e44fc470d54cf67245118b064ed1221 to your computer and use it in GitHub Desktop.
Save mpstenson/4e44fc470d54cf67245118b064ed1221 to your computer and use it in GitHub Desktop.
unserialize tEmailHeaders from the HelpSpot API
<?php
$var=html_entity_decode("a:25:{s:12:&quot;delivered-to&quot;;a:2:{i:0;s:32:&quot;matts-test-instance@helpspot.com&quot;;i:1;s:32:&quot;matts-test-instance@helpspot.com&quot;;}s:11:&quot;return-path&quot;;a:2:{i:0;s:24:&quot;&lt;matt.stenson@gmail.com&gt;&quot;;i:1;s:24:&quot;&lt;matt.stenson@gmail.com&gt;&quot;;}s:8:&quot;received&quot;;a:4:{i:0;s:208:&quot;from director7.mail.ord1c.rsapps.net ([172.28.128.196]) by store367a.mail.iad3a.rsapps.net (Dovecot) with LMTP id N2bALtrEWlfIbgAASskMtg for &lt;matts-test-instance@helpspot.com&gt;; Fri, 10 Jun 2016 10:45:29 -0400&quot;;i:1;s:214:&quot;from smtp44.gate.ord1c ([172.28.255.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) by director7.mail.ord1c.rsapps.net (Dovecot) with LMTP id bjRlPqWWDVcXCQAAqdfm7w ; Fri, 10 Jun 2016 10:45:29 -0400&quot;;i:2;s:349:&quot;from [209.85.218.68] ([209.85.218.68:33976] helo=mail-oi0-f68.google.com) by smtp44.gate.ord1c.rsapps.net (envelope-from &lt;matt.stenson@gmail.com&gt;) (ecelerity 2.2.3.49 r(42060/42061)) with ESMTPS (cipher=AES128-SHA subject=&quot;/C=US/ST=California/L=Mountain View/O=Google Inc/CN=smtp.gmail.com&quot;) id B9/86-17560-882DA575; Fri, 10 Jun 2016 10:45:28 -0400&quot;;i:3;s:135:&quot;by mail-oi0-f68.google.com with SMTP id r4so13608813oib.1 for &lt;matts-test-instance@helpspot.com&gt;; Fri, 10 Jun 2016 07:45:28 -0700 (PDT)&quot;;}s:16:&quot;x-spam-threshold&quot;;s:2:&quot;95&quot;;s:12:&quot;x-spam-score&quot;;s:1:&quot;0&quot;;s:11:&quot;x-spam-flag&quot;;s:2:&quot;NO&quot;;s:15:&quot;x-virus-scanned&quot;;s:2:&quot;OK&quot;;s:22:&quot;authentication-results&quot;;a:2:{i:0;s:72:&quot;smtp44.gate.ord1c.rsapps.net header.DKIM-Signature=@gmail.com; dkim=pass&quot;;i:1;s:143:&quot; smtp44.gate.ord1c.rsapps.net x-tls.subject=&quot;/C=US/ST=California/L=Mountain View/O=Google Inc/CN=smtp.gmail.com&quot;; auth=pass (cipher=AES128-SHA)&quot;;}s:28:&quot;x-messagesniffer-scan-result&quot;;s:1:&quot;0&quot;;s:22:&quot;x-messagesniffer-rules&quot;;s:12:&quot;0-0-0-3070-c&quot;;s:18:&quot;x-cmae-scan-result&quot;;s:1:&quot;0&quot;;s:15:&quot;x-cnfs-analysis&quot;;s:105:&quot;v=2.2 cv=DJfN2GFb c=1 sm=0 tr=0 a=jXSsW8IEtbrQOUZwQrvHUQ==:117 a=pD_ry4oyNxEA:10 a=_-Ne7qywE6DHSfEP9qcA:9&quot;;s:9:&quot;x-orig-to&quot;;s:32:&quot;matts-test-instance@helpspot.com&quot;;s:16:&quot;x-originating-ip&quot;;s:15:&quot;[209.85.218.68]&quot;;s:14:&quot;dkim-signature&quot;;s:511:&quot;v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=ZfXQILiy/v2US2szPWe9+hAF59Kzt6B+B1RRV8T0zW8=; b=GsuN1UQT+kxAUEAH0vWHDZvzHDUaV/xfEVBeMCMMUwpIMJw03OWr+T6JQH4T+4rptJ Xv+Eh8kenfivQi0ysPXWa7swbHgBVI47PJuFy6e6bAoLPjbIcGpV7R4e1wh5mWQO6HYx gbSqZ1J9VjqyRXAhaRROCmk1TwsUeNRjUVARY8ldp0FgfMLjsOmHkvb4E5+AsFRJ1UJl KDieckBw/R8wgxAc6Vc824CNCVRsTD1kLb/cPGmV71qfEqeO4NwxVhJiIcWqkF+u+kuV R3EPP+p56t6cDzRi0j5BkDDRg7nrqInbxR3ZXhnNwCj3X0JjrGY9u5Z5Vda4Oy4hOewQ 2CNw==&quot;;s:23:&quot;x-google-dkim-signature&quot;;s:530:&quot;v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=ZfXQILiy/v2US2szPWe9+hAF59Kzt6B+B1RRV8T0zW8=; b=ame4fMJsCDMs44kqtFWKs8RVhr7EH/x+qOnO8tspWcbP74iW66EFQshmWhL5DXCZEe 7OLYvMJbZhuG0jpCiMNuOdjLhUaJ1Hx7COnfmPtKFcTcVFLh3gYecuK4eOd2guBUg6DP 0yyYJGqQRTnKcZ+lm/SzGixbjftKinerJwcnNHThffpEMgi66ZhLbTPxQc13L0rLsXIF k03ZVSzfYs0N2E2TPqaBzqj3jgsX05FbdxbhuyQrYORaJGjtlT5ccPnl7hpt+ez7GB5b KnOfmkLAVZY5U3UXK1tfVAIe7qlqlj61IZ3ZMIjOI7wieY3Yjz6Je0lQEhy7kqIPL2ku uz9w==&quot;;s:18:&quot;x-gm-message-state&quot;;s:88:&quot;ALyK8tI8tK1N88DBe2wDv2RM3D9hA+c33ujQh+5YPgGgpOIUujPOvWRVv5zRg+WfT3xmRYhk6pt9ueeIH0ks/Q==&quot;;s:10:&quot;x-received&quot;;s:100:&quot;by 10.202.229.1 with SMTP id c1mr1222193oih.180.1465569927939; Fri, 10 Jun 2016 07:45:27 -0700 (PDT)&quot;;s:12:&quot;mime-version&quot;;s:3:&quot;1.0&quot;;s:4:&quot;from&quot;;s:40:&quot;Matthew Stenson &lt;matt.stenson@gmail.com&gt;&quot;;s:4:&quot;date&quot;;s:31:&quot;Fri, 10 Jun 2016 14:45:18 +0000&quot;;s:10:&quot;message-id&quot;;s:68:&quot;&lt;CALmgRaYxApm1Uumrv_peTo4TA57Y7h4gRmVpk8JZzFuZObj=Uw@mail.gmail.com&gt;&quot;;s:7:&quot;subject&quot;;s:11:&quot;Trigger it!&quot;;s:2:&quot;to&quot;;s:54:&quot;matts-test-instance &lt;matts-test-instance@helpspot.com&gt;&quot;;s:12:&quot;content-type&quot;;s:60:&quot;multipart/alternative; boundary=001a11403486f2cd540534ed96a0&quot;;}", ENT_COMPAT, 'UTF-8');
$var = trim($var);
if(is_string($var) && !empty($var)){
var_dump(unserialize($var));
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment