ds3422222222 2017-04-25 09:00
浏览 45

Yammer SDK - 获取用户信息(JSON到PHP)

I've just implemented the Yammer Login SDK on my web application. Once logged in, I can see the user information just fine with this code:

yam.getLoginStatus(
function(response) {
if (response.authResponse) {
  console.log("logged in");

  yam.platform.request({
    url: "users/current.json", //this is one of many REST endpoints that are available
    method: "GET",
    data: {    //use the data object literal to specify parameters, as documented in the REST API section of this developer site
      "page": "2",
    },
    success: function (user) { //print message response information to the console
      alert("The request was successful.");
      console.dir(user);

    },
    error: function (user) {
      alert("There was an error with the request.");
    }
  });

}
else {
  alert("not logged in")
}
}
);

However this only shows my information as a JSON "Object" in my console log. I want to access all this GET information so that I can upload this information into a MySQL database. This is how I see the info in my console log:

JSON Object

I basically need to access this information so I can use it in PHP.

  • 写回答

1条回答 默认 最新

  • dongra1984 2017-04-25 11:15
    关注

    I changed my code to pass it directly to a POST AJAX.

    functionyam.getLoginStatus(
    function(response) {
    if (response.authResponse) {
    
        $.ajax({
            type:'POST',
            url: 'functions/test.php',
            data:response,
            success:function(data){
                $("#usershow").empty();
                $("#usershow").delay(300).fadeIn(200).append(data);
            },
            error: function(data){
                $("#usershow").empty();
                $("#usershow").append("There was a problem with your query. Please try again later.");
            }
            });
    
    }
    else {
      yam.platform.login(function (response) { //prompt user to login and authorize your app, as necessary
        if (response.authResponse) {
    
        $("#usershow").text('OTHER IF FUNCTION');   
        }
      });
    }
    }
    );
    
    评论

报告相同问题?

悬赏问题

  • ¥15 matlab有限元法求解梁带有若干弹簧质量系统的固有频率
  • ¥15 找一个网络防御专家,外包的
  • ¥100 能不能让两张不同的图片md5值一样,(有尝)
  • ¥15 informer代码训练自己的数据集,改参数怎么改
  • ¥15 请看一下,学校实验要求,我需要具体代码
  • ¥50 pc微信3.6.0.18不能登陆 有偿解决问题
  • ¥20 MATLAB绘制两隐函数曲面的交线
  • ¥15 求TYPCE母转母转接头24PIN线路板图
  • ¥100 国外网络搭建,有偿交流
  • ¥15 高价求中通快递查询接口