此代码返回您SIM卡的号码,可以与http请求一起正常工作并返回MSISDN,但是当您使用https协议请求时,则不会返回任何号码。
答案 0 :(得分:0)
我使用此功能来检测访问者的MSISDN-
public function getMSISDN()
{
if(isset($_SERVER['HTTP_X_UP_CALLING_LINE_ID']))
{
# Mostly this Server Vars Attribute all mobile phones
$msisdn = trim($_SERVER['HTTP_X_UP_CALLING_LINE_ID']);
}
else if(isset($_SERVER['HTTP_X_HTS_CLID']))
{
# Mostly this Server Vars Attribute is for Nokia and SonyEricsson
$msisdn = trim($_SERVER['HTTP_X_HTS_CLID']);
}
else if(isset($_SERVER['HTTP_MSISDN']))
{
# Mostly this Server Vars Attribute is for Motorola and Siemens
$msisdn = trim($_SERVER['HTTP_MSISDN']);
}
else if(isset($_SERVER['X_MSISDN']))
{
# Mostly this Server Vars Attribute is for Motorola and Siemens
$msisdn = trim($_SERVER['X_MSISDN']);
}
else if(isset($_SERVER['X-MSISDN']))
{
# Mostly this Server Vars Attribute is for Motorola and Siemens
$msisdn = trim($_SERVER['X-MSISDN']);
}
else if(isset($_SERVER['HTTP_X_WAP_NETWORK_CLIENT_MSISDN']))
{
# Mostly this Server Vars Attribute is for Motorola and Siemens
$msisdn = trim($_SERVER['HTTP_X_WAP_NETWORK_CLIENT_MSISDN']);
}
else
{
$msisdn = $_COOKIE['User-Identity-Forward-msisdn'];
}
if( $msisdn == '' )
{
$headers = apache_request_headers();
# $msisdn = $headers['x-msisdn'] ? $headers['x-msisdn'] : exit;
$msisdn = $headers['x-msisdn'];
}
return $msisdn;
}