Retrieving an iPhone Response with PHP

Note: It's anticipated that you have already gone over and understand the basics of setting up an iPhone managed profile.

In some configuration profiles (namely, when using the Profile Service PayloadType), the iPhone will respond to a given URL. This response is sent as a POST to the URL and is signed by the built-in Apple security certificate for the device.

There is just a little trick to properly getting this response and working with it in PHP.

The response is sent as Content-type: application/pkcs7-signature, so PHP does not put it as a $_POST variable by default. You'll want to do the following in this case:
$iPhoneSignedResponse = file_get_contents('php://input');

Now you'll have a DER encoded response from the iPhone.

-----
I hope this helps someone. Let me know if there are errors above and I'll update this document.
-W Gillespie (wgillespie, es2eng.com)

Last updated: 2010-03-12