php redirect header location to phone number

半世苍凉 提交于 2019-12-23 23:09:19

问题


I'm trying to redirect the user's click on a link to a telephone number through php like this:

//HTML
<a href="tele.php">

and the php:

<?php
header("Location: tel:+123456789");
exit;
?>

This works on newer mobile browsers but won't on the older ones in particular Nokia WAP2.0 browser. Any ideas, plaese?


回答1:


Try wtai://wp/mc;xxxxxxxxx instead of tel:.




回答2:


I've found a solution after few trials.

I set up a third-level domain of my main domain: call.mydomain.it. In its docroot I placed an index.php file containing these lines:

<?php
if(isset($_GET['tel']) && $_GET['tel'] != "")
{
    $tel = $_GET['tel'];
    header("Location: tel://$tel");
}
die();
?>

So, when I load call.mydomain.it/?tel=00393331234567 the browser starts a call to the number passed as argument.

Further on, if you have to setup a web marketing campaign, you can shrink this url with this free tool

Hope having helped you



来源:https://stackoverflow.com/questions/11293349/php-redirect-header-location-to-phone-number

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!