如何在.php页面执行的php结果中保存数据? [英] How to save data in php results executed by a .php page?

查看:155
本文介绍了如何在.php页面执行的php结果中保存数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道如何保存由php页面执行的数据.就像这样.

I need to know how to save data executed by a php page..Like this.

http://www.facebook.com/ajax/typeahead_friends. php?& __ a = 1

上面的链接显示了当前Facebook用户的朋友列表(名称,用户ID) 所以我想得到它们并保存它们?如何将朋友用户ID保存到我的datbase?

Above link shows current facebook user's friends list (name,user id) So i want to get them and save them? How to save friends user ids' to my datbase?

推荐答案

调用结果看起来像一个简单的JSON,除了"for(;;);"一开始.如果删除这些字符,则应该能够使用将json转换为语言哈希的序列化器(根据您的使用)

The result of the call looks like a simple JSON except for "for (;;);" at the beginning. If you strip those characters, you should be able to use a serializer that convers json to language hash ( based on what you use )

import json
resulting_fiends_txt = '<put the text after you have removed for (;;);'   
friends = json.loads(resulting_frields_txt)['payload']['friends']
for f in friends:
    print "ID: %s, Name: %s" % (f['i'], f['t'])

一旦您有权访问这些字段,就可以随时保存它.

once you have access to those fields, you can save it anyway you like.

这篇关于如何在.php页面执行的php结果中保存数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆