Created
August 7, 2011 04:49
-
-
Save Gurpartap/1130056 to your computer and use it in GitHub Desktop.
Compare iOS app version with latest version from server
This file contains hidden or 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 | |
$request_body = @file_get_contents('php://input'); | |
$request_data = json_decode($request_body, true); | |
$bundle_version = $_GET['bundleVersion']; | |
$latest_version = "1.0.1"; | |
if (version_compare($bundle_version, $latest_version, '<')) { | |
$result = array( | |
'needsUpdate' => TRUE, | |
'latestVersion' => $latest_version | |
); | |
} | |
else { | |
$result = array( | |
'needsUpdate' => FALSE, | |
'latestVersion' => $latest_version | |
); | |
} | |
header('Content-Type: application/download'); | |
exit (json_encode($result)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment