㈠ php怎么实现像百姓网,58同城网,赶集网,城市IP定位 代码更好!
城市ip定位?如果要用ip来知道地址的话,必须有ip和地址的对应库,现在很多DNS服务器可以做到这一点。所以这个还是需要有一定的基础数据才行 。如果是手机定位的话,主要是通过和邻近的几个信号站,返回的延迟时间不同,推算出来的。
㈡ php怎么调取手机GPS位置
php无法调取,但是你可以通过html5获取经纬度之后再使用ajax传到php进行处理
㈢ php 有谁知道网页获取手机用户位置吗
网页是获取不到的,你发的截图是Android系统中的
GPS手机定位
,所以能够获取到你的位置。但是单独通过PHP
网页是无法获取定位的。
㈣ 在PHP里写一个内部搜索功能,能够通过表里的任何字段进行搜索定位,我是个菜鸟,需要源码,谢谢!好心人呢
建立一个index.php文件, 代码如下,其中中文标出的是你自己修改的地方!
1,搜索按钮
<form action="index.php" method="post" name="搜索的关键字" id="搜索的关键字">
<input name="搜索的关键字" type="text" id="搜索的关键字" />
<input name="Submit" type="submit" value="搜" />
</form>
2,结果显示
<?php
include("链接文件路径");
$搜索的关键字=$_POST[搜索的关键字];
$sql1=mysql_query("select * from 数据库表名 where (数据库字段 like'%$搜索的关键字%')");
$info1=mysql_fetch_array($sql1);
?>
<?php do { ?>
<?php echo $info1['要显示的搜索结果字段']; ?>
<?php } while ($info1 = mysql_fetch_assoc($sql1)); ?>
㈤ php的 ip 定位,经纬度至少精确到镇,附上源码和详解
ip定位一般对于电脑来说的,精确到镇有点难,淘宝的ip api服务,只能精确到区,或者市
手机的话,你需要获取位置,位置会因为手机质量的好坏,偏差很大,苹果和诺基亚手机定位很准,安卓各种机型,各种偏差,使用手机定位的是,html5有获取定位的方法,然后得到经纬度,发到网络地图 api,获取更精确的地址,
ip定位想要那么精确,有点难,你得找个好点的ip库服务,达到你要的精读就行
㈥ PHP如何实现手机定位,求代码!
这个需要有客户端并获取系统权限,监听拨打电话的号码,符合条件打开GPS,获取经纬度发送到指定后台
㈦ php微信获取地理位置
用你的手机号申请一个微信公众号,登录微信公众号平台,那里有地理位置的接口说明,直接粘贴源码后,通过服务器运行即可。
㈧ 手机js页面实现一键定位,并且把获取的地理位置显示到文本框中,如下图,100分
手机js页面实现一键定位,并且把获取的地理位置显示到文本框中代码如下:
var getLocation = function (successFunc, errorFunc) { //successFunc获取定位成功回调函数,errorFunc获取定位失败回调
//首先设置默认城市
var defCity = {
id: '000001',
name: '北京市',
date: curDateTime()//获取当前时间方法
};
//默认城市
$.cookie('VPIAO_MOBILE_DEFAULTCITY', JSON.stringify(defCity), { expires: 1, path: '/' });
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var lat = position.coords.latitude;
var lon = position.coords.longitude;
//var map = new BMap.Map("container"); // 创建Map实例
var point = new BMap.Point(lon, lat); // 创建点坐标
var gc = new BMap.Geocoder();
gc.getLocation(point, function (rs) {
var addComp = rs.addressComponents;
var curCity = {
id: '',
name: addComp.province,
date: curDateTime()
};
//当前定位城市
$.cookie('VPIAO_MOBILE_CURRENTCITY', JSON.stringify(curCity), { expires: 7, path: '/' });
//alert(addComp.province + ", " + addComp.city + ", " + addComp.district + ", " + addComp.street);
if (successFunc != undefined)
successFunc(addComp);
});
},
function (error) {
switch (error.code) {
case 1:
alert("位置服务被拒绝。");
break;
case 2:
alert("暂时获取不到位置信息。");
break;
case 3:
alert("获取位置信息超时。");
break;
default:
alert("未知错误。");
break;
}
var curCity = {
id: '000001',
name: '北京市',
date: curDateTime()
};
//默认城市
$.cookie('VPIAO_MOBILE_DEFAULTCITY', JSON.stringify(curCity), { expires: 1, path: '/' });
if (errorFunc != undefined)
errorFunc(error);
}, { timeout: 5000, enableHighAccuracy: true });
} else {
alert("你的浏览器不支持获取地理位置信息。");
if (errorFunc != undefined)
errorFunc("你的浏览器不支持获取地理位置信息。");
}
};
var showPosition = function (position) {
var lat = position.coords.latitude;
var lon = position.coords.longitude;
//var map = new BMap.Map("container"); // 创建Map实例
var point = new BMap.Point(lon, lat); // 创建点坐标
var gc = new BMap.Geocoder();
gc.getLocation(point, function (rs) {
var addComp = rs.addressComponents;
var curCity = {
id: '',
name: addComp.province,
date: curDateTime()
};
//当前定位城市
$.cookie('VPIAO_MOBILE_CURRENTCITY', JSON.stringify(curCity), { expires: 7, path: '/' });
//alert(addComp.province + ", " + addComp.city + ", " + addComp.district + ", " + addComp.street);
});
};
var showPositionError = function (error) {
switch (error.code) {
case 1:
alert("位置服务被拒绝。");
break;
case 2:
alert("暂时获取不到位置信息。");
break;
case 3:
alert("获取位置信息超时。");
break;
default:
alert("未知错误。");
break;
}
var curCity = {
id: '000001',
name: '北京市',
date: curDateTime()
};
//默认城市
$.cookie('VPIAO_MOBILE_DEFAULTCITY', JSON.stringify(curCity), { expires: 1, path: '/' });
};
㈨ php怎么实现定位除了ip
可以使用html5定位,之后通过js发给php,php接受的header里面除了ip以外没有别的办法可以分析出具体位置了。但是html5是根据电脑所在地址分析的,如果设备支持gps就可以通过gps拿到对方精确位置。
<!DOCTYPE html>
<html>
<body>
<p id="demo">Click the button to get your coordinates:</p>
<button onclick="getLocation()">Try It</button>
<script>
var x=document.getElementById("demo");
function getLocation()
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showPosition);
}
else{x.innerHTML="Geolocation is not supported by this browser.";}
}
function showPosition(position)
{
x.innerHTML="Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude;
}
</script>
</body>
</html>
㈩ php怎么获取手机客户端ip
php获取客户端ip地址方法总结
用php获取客户端ip地址的方法,具体代码如下:
?php
$iipp=$_server["remote_addr"];
echo
$iipp;
?
///////////////////////////////////////////////
?php
$user_ip
=
($_server["http_via"])
?
$_server["http_x_forwarded_for"]
:
$_server["remote_addr"];
$user_ip
=
($user_ip)
?
$user_ip
:
$_server["remote_addr"];
echo
$user_ip;
?
///////////////////////////////////////////////
?php
function
get_real_ip(){
$ip=false;
if(!empty($_server["http_client_ip"])){
$ip
=
$_server["http_client_ip"];
}
if
(!empty($_server['http_x_forwarded_for']))
{
$ips
=
explode
(",
",
$_server['http_x_forwarded_for']);
if
($ip)
{
array_unshift($ips,
$ip);
$ip
=
false;
}
for
($i
=
0;
$i
<
count($ips);
$i++)
{
if
(!eregi
("^(10|172.16|192.168).",
$ips[$i]))
{
$ip
=
$ips[$i];
break;
}
}
}
return
($ip
?
$ip
:
$_server['remote_addr']);
}
echo
get_real_ip();
?
///////////////////////////////////////////////
php获取ip的算法:
?php
if
($http_server_vars["http_x_forwarded_for"])
{
$ip
=
$http_server_vars["http_x_forwarded_for"];
}
elseif
($http_server_vars["http_client_ip"])
{
$ip
=
$http_server_vars["http_client_ip"];
}
elseif
($http_server_vars["remote_addr"])
{
$ip
=
$http_server_vars["remote_addr"];
}
elseif
(getenv("http_x_forwarded_for"))
{
$ip
=
getenv("http_x_forwarded_for");
}
elseif
(getenv("http_client_ip"))
{
$ip
=
getenv("http_client_ip");
}
elseif
(getenv("remote_addr"))
{
$ip
=
getenv("remote_addr");
}
else
{
$ip
=
"unknown";
}
echo
"你的ip:".$ip
;
?
///////////////////////////////////////////////
?php
if(getenv('http_client_ip'))
{
$onlineip
=
getenv('http_client_ip');
}
elseif(getenv('http_x_forwarded_for'))
{
$onlineip
=
getenv('http_x_forwarded_for');
}
elseif(getenv('remote_addr'))
{
$onlineip
=
getenv('remote_addr');
}
else
{
$onlineip
=
$http_server_vars['remote_addr'];
}
echo
$onlineip;
?