curl 本地请求获取token 非常快,200毫左右就有返回值,放到线上怎么回非常慢呢?将近10秒才返回值
现在真不知道什么原因了,怎么会差这么大呢?求大神指点迷津。
$url="http://201.61.87.182:8003/spring-oauth-server/oauth/token?client_id=8a06727bc799478988c79778c1954abc&client_secret=X5vcC5GhWi6TsVBDEmFRgwzNLJzDtezu&grant_type=password&scope=read&username=123&password=123";
//请求参数
$post_data=array(
'client_id'=>'8a06727bc799478988c79778c1954abc',
'client_secret'=>'X5vcC5GhWi6TsVBDEmFRgwzNLJzDtezu',
'grant_type'=>'password',
'scope'=>'read',
'username'=>'123',
'password'=>'123'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
// post数据 设置0或1不显示或显示返回信息
curl_setopt($ch, CURLOPT_POST, 0);
// post的变量
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
// 请求结果付给一个变量
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
//执行请求
$output = curl_exec($ch);
curl_close($ch);