i can get the iPhone udid and send it to the server. But when i compare the udid sent from the iPhone and the udid from my server, my php code never found anything that match.
I am sure there is a UDID that matches the one sent from iPhone, but my php code never found it.
$udid = $_POST["udid"]; // i.e: abcd1234 the udid from iPhone is trim and "-" removed.
$udid_from_server = "abcd1234";
if(strcasecmp($udid_from_server, $udid) == 0){
//do something...
}else{
//do something else
}
the php code never gets into //do something
Have you done a var_dump on both strings to verify that the UDID is in fact sanitized as you think (i.e. hyphens removed, all lower case, etc.)?
If so you should be able to to a comparison like
if($udid == $udid_from_server) {
// match
} else {
// not match
}
By the way, you shouldn't get comfortable with the idea with getting the UDID from iOS device, as its use has been deprecated and Apple will often reject app submissions that call for UDID to be used. Probably best to look at using MAC address or your own unique identifier.