一定要注意:这里的key是如图所示:是WEB服务API的key
tableid使用本表对应得:
$bs='gdadd';
//高德地图
if($bs=='gdadd'){
$gdcreate= 'http://yuntuapi.amap.com/datamanage/data/create';
$locations=$_POST['zuobiao']?$_POST['zuobiao']:$_GET['zuobiao'];
$openid='1234';$phone='5678';$phonetype='1';$cid='3';
$_data = json_encode(array('_name' =>$_POST['mingcheng'], '_location' =>$locations,'_address' =>$_POST['weizhi'],'mingcheng'=>$_POST['mingcheng'],'zhaopian'=>$_POST['zhaopian'],'xianshi' =>$_POST['xianshi']));
//echo $_data;
$date="key=9a9c5d6acf7495d1b7401dbbd3655277" . $gdkey . "&tableid=57d289477bbf195d70fbcf13" . $gdtableid . "&loctype=1&data=" . $_data;
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_URL, $gdcreate);
curl_setopt($ch, CURLOPT_POSTFIELDS, $date);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/x-www-form-urlencoded; charset=utf-8',
)
);
$rslut = curl_exec($ch);
curl_close($ch);
$rslut= json_decode($rslut,true);
print_r($rslut);
if($rslut['_id']){
$response=array('code'=>200,'obj'=>array('id'=>$rslut['_id']));
}else{
$response=array('code'=>4444);
}
}