I am doing a web server for updating a pass. I test for updating by turn the toggle on or off for automatic updates. This is what I get from console:
Apr 8 13:19:47 CamMobs-iPod4 passd[21] <Warning>: Get pass task (pass type pass.cam-mob.passbookpasstest, serial number 0001, if-modified-since (null); with web service url http://192.168.1.202:8888/passesWebserver/) encountered error: Server response was malformed (Missing response data)
This is the code I use:
if (strtoupper($_SERVER['REQUEST_METHOD']) === "GET" && $request[3]==='passes'){
$passTypeID = $request[4];
$serial = $request[5];
$auth_key = str_replace('ApplePass ', '', $headers['Authorization']);
$querySelect = mysql_query("select * from registration");
$row = mysql_fetch_array($querySelect);
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])){
if ($passTypeID == $row['passTypeID'] && $serial ==$row['serialNo']){
$pkpass_file = '/Applications/MAMP/htdocs/passesWebserver/DigiClubCard.pkpass';
header("Pragma: no-cache");
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Content-type: application/vnd.apple.pkpass; charset=UTF-8");
header('Content-Disposition:attachment; filename="genericPass.pkpass"');
clearstatcache();
$filesize = filesize($pkpass_file);
if ($filesize)
header("Content-Length: ". $filesize);
header('Content-Transfer-Encoding: binary');
if (filemtime($pkpass_file)) {
date_default_timezone_set("UTC");
header('Last-Modified: ' . date("D, d M Y H:i:s", filemtime($pkpass_file)) . ' GMT');
}
flush();
readfile($pkpass_file);
} } }`