Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example code to get comments details #31

Open
squirrel27 opened this issue Feb 11, 2017 · 3 comments
Open

Example code to get comments details #31

squirrel27 opened this issue Feb 11, 2017 · 3 comments

Comments

@squirrel27
Copy link

I am completely new to php but thanks to your example I was able to get info about media like caption, date etc, but when it comes to details about comments, it returns no info. Could you please provide an example on how to get comments id, text or user id?
(I'm trying with $value->comments->text and have no idea where my mistake is)
Thank you!

@pixelbart
Copy link

pixelbart commented Feb 12, 2017

Hi @squirrel27 ... you can check your code with print_r($value) ... then you can see what is possible and what not.

If it is an object you work with $value->comments and if it is an array you work with $value['comments'] ...

Thats are just the basics. Just test it out. (Some other PHP stuff for this: foreach ... google it for more informations or post a question)

@squirrel27
Copy link
Author

Hi @pixelbart thank you!
I was using fwrite to write output (comments' text and id) on a text file but I was getting blanks. Using print_r($value) I can see outputs on the shell so at least now I know my code is not totally wrong...

@pixelbart
Copy link

Hi @squirrel27

fwrite is for writing in files. Files are .txt or other files.

To simply "write" your content you can use the echo command.

echo $value->comments

If you can write me your output from print_r($value) i can "teach" you exactly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants