标签:tip oba var taobao uil info tput nsf init
方式一
$url = ‘http://ip.taobao.com/service/getIpInfo.php?ip=‘.$realip;
$data = file_get_contents("$url");
$arr= json_decode($data, true);
方式二
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);//要访问的地址
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);//执行结果是否被返回,0是返回,1是不返回
curl_setopt($ch, CURLOPT_POST, 1);// 发送一个常规的POST请求
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($sl_data));
$output = curl_exec($ch);//执行并获取数据
var_dump(json_decode($output, true));
// $arr = json_decode($output);
// var_dump($arr);
curl_close($ch);
die;
标签:tip oba var taobao uil info tput nsf init
原文地址:https://www.cnblogs.com/nzc520/p/10659508.html