【发布时间】: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