Answer the question
In order to leave comments, you need to log in
How to extract the desired value?
When the bot receives a photo in a message, it returns the following query result:
{"type":"message_new","object":{"id":21,"date":1549999669,"out":0,"user_id":XXX,"read_state":0,"title":"","body":"","attachments":[{"type":"photo","photo":{"id":XXX,"album_id":-3,"owner_id":XXX,"photo_75":"https:\/\/pp.userapi.com\/c847124\/v847124220\/19df30\/BRfTwvsNzIY.jpg","photo_130":"https:\/\/pp.userapi.com\/c847124\/v847124220\/19df31\/LKbwyjwb1Ag.jpg","photo_604":"https:\/\/pp.userapi.com\/c847124\/v847124220\/19df32\/IUsQgkOm1zM.jpg","photo_807":"https:\/\/pp.userapi.com\/c847124\/v847124220\/19df33\/LHknGn3O8_s.jpg","photo_1280":"https:\/\/pp.userapi.com\/c847124\/v847124220\/19df34\/Z19Mgr2bifI.jpg","width":647,"height":960,"text":"","date":1549999667,"access_key":"ddcefea2de81b39bd4"}}]},"group_id":XXX}
$user_id = $data->object->user_id;
Answer the question
In order to leave comments, you need to log in
$data->object->attachments;
run attachments in a loop and watch
because it will not always return the photo field with 0
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question