【问题标题】:Google social Graph response decode谷歌社交图响应解码
【发布时间】:2011-12-23 10:37:41
【问题描述】:

我想制作一个脚本,自动将从中提取的 Google+ ID 插入到数组中 SocialGraphs Api 但我不明白这个结果的类型,这里是结果的例子:http://pastebin.com/wfBAtjH7

如果可以帮助,我已经看到了用 Javascript 完成的隔离 ID 的方法:

var oids = [];
var reobg = new RegExp("\\d{21}","g"); // only interested in user ID so prepare regexp
oids = resp.match(reobg); // get an array of ids
if (!oids == null){ // if something stringify it
   oids = oids.join(",");
}

为了获取所有文本的变量,我使用了以下代码:

$gplus = file_get_contents('https://plus.google.com/u/0/_/socialgraph/lookup/visible/?o=[null,null,"103227580967788703328"]&rt=j');

其中 103227580967788703328 是 Google Plus ID 示例。

提前致谢。

亲切的问候。

卢卡。

【问题讨论】:

  • 这看起来像 json...print_r(json_decode($result)) 这应该告诉你如何访问它。 (如果没有将结果粘贴到 pastebin 并给我们链接。)
  • 我已经尝试过简单的 Json_decode 但不是纯 Json。发布了获取结果的完整链接和方法。感谢您的帮助。

标签: php regex social-networking json


【解决方案1】:

尝试使用此正则表达式循环输入:

\[\[,,"(\d+)"\]

每次都抢第一组。

【讨论】:

  • 工作得很好,我不知道该怎么说谢谢。再次感谢。
【解决方案2】:

试试这个\[(.*),(.*),"(.*)"\]这可能对你有帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-29
    • 2019-02-01
    • 2018-07-12
    • 2013-03-03
    • 2018-02-05
    相关资源
    最近更新 更多