Last active
October 14, 2017 21:05
-
-
Save Shaked/484e2c59a71621583c17c1e9ccb869b6 to your computer and use it in GitHub Desktop.
How to receive Messenger API location/image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if ($message->hasAttachments()) { | |
| $attachments = $message->getAttachments(); | |
| $location = []; | |
| foreach ($attachments as $attachment) { | |
| switch($attachment['type']) { | |
| case 'location': | |
| $lat = $attachment['payload']['coordinates']['lat']; | |
| $long = $attachment['payload']['coordinates']['long']; | |
| break; | |
| case 'image': | |
| $url = $attachment['payload']['url'] | |
| break; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment