PHP-Instagram-Grabber icon indicating copy to clipboard operation
PHP-Instagram-Grabber copied to clipboard

Example code to get comments details

Open squirrel27 opened this issue 8 years ago • 3 comments

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!

squirrel27 avatar Feb 11 '17 21:02 squirrel27

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)

pixelbart avatar Feb 12 '17 05:02 pixelbart

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...

squirrel27 avatar Feb 13 '17 14:02 squirrel27

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.

pixelbart avatar Feb 15 '17 09:02 pixelbart