[英]Get data from Facebook Graph API with JSON
I want to print the ID of the comment (eg. 10151828637085391_33268745
) from this page but I don't know how to get pass the URL. 我想从该页面打印评论的ID(例如10151828637085391_33268745
),但是我不知道如何通过URL。 After I had decoded the data with JSON and printed it out with var_dump()
it looks like this: 在使用JSON解码数据并使用var_dump()
其打印出来之后,它看起来像这样:
array
'http://gallery.erik-edgren.nu/photo/P1220672' =>
array
'comments' =>
array
'data' =>
array
...
'paging' =>
array
...
So far so good. 到现在为止还挺好。 I have tried to write $array->http://gallery.erik-edgren.nu/photo/P1220672->comments->data->id
but the //
make the whole string to a comment on the website. 我试图写$array->http://gallery.erik-edgren.nu/photo/P1220672->comments->data->id
但//
将整个字符串添加到网站上的评论中。 I have even tried to add \\
before I print the /
( $array->http:\\/\\/galle...
) but I'm getting the following error message: 在打印/
( $array->http:\\/\\/galle...
)之前,我什至尝试添加\\
,但收到以下错误消息:
Parse error: syntax error, unexpected ':' in ...
How can I fix this problem? 我该如何解决这个问题?
Thanks in advance. 提前致谢。
我相信您需要做$array['http://gallery.erik-edgren.nu/photo/P1220672']['comments']['data']['id']
,因为它是一个数组,不是一个对象。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.