PHP-Instagram-Grabber
PHP-Instagram-Grabber copied to clipboard
Example code to get comments details
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!
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)
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...
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.